提交 0ef48169 编写于 作者: m0_50812349's avatar m0_50812349

service层注释规范化

......@@ -8,6 +8,7 @@ import (
"gin-vue-admin/service"
"gin-vue-admin/utils"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"go.uber.org/zap"
"net/url"
"os"
......@@ -78,9 +79,16 @@ func CreateTemp(c *gin.Context) {
}
err := service.CreateTemp(a)
if err != nil {
c.Writer.Header().Add("success", "false")
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
_ = os.Remove("./ginvueadmin.zip")
if errors.Is(err, model.AutoMoveErr) {
c.Writer.Header().Add("success", "false")
c.Writer.Header().Add("msgtype", "success")
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
} else {
c.Writer.Header().Add("success", "false")
c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
_ = os.Remove("./ginvueadmin.zip")
}
} else {
c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "ginvueadmin.zip")) // fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名
c.Writer.Header().Add("Content-Type", "application/json")
......
package model
import "errors"
// 初始版本自动化代码工具
type AutoCodeStruct struct {
StructName string `json:"structName"`
......@@ -24,3 +26,5 @@ type Field struct {
FieldSearchType string `json:"fieldSearchType"`
DictType string `json:"dictType"`
}
var AutoMoveErr error = errors.New("创建代码成功并移动文件成功")
......@@ -68,7 +68,7 @@ service.interceptors.response.use(
Message({
showClose: true,
message: response.data.msg || decodeURI(response.headers.msg),
type: 'error',
type: response.headers.msgtype||'error',
})
if (response.data.data && response.data.data.reload) {
store.commit('user/LoginOut')
......
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
const animationDuration = 3000
export default {
name:'RaddarChart',
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.initChart()
/* this.__resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize()
}
}, 100)
window.addEventListener('resize', this.__resizeHandler)*/
},
beforeDestroy() {
if (!this.chart) {
return
}
// window.removeEventListener('resize', this.__resizeHandler)
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'light')
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
radar: {
radius: '66%',
center: ['50%', '42%'],
splitNumber: 8,
splitArea: {
areaStyle: {
color: 'rgba(255,192,203,.3)',
opacity: 1,
shadowBlur: 45,
shadowColor: 'rgba(0,0,0,.5)',
shadowOffsetX: 0,
shadowOffsetY: 15
}
},
indicator: [
{ name: 'Sales', max: 10000 },
{ name: 'Administration', max: 20000 },
{ name: 'Information Techology', max: 20000 },
{ name: 'Customer Support', max: 20000 },
{ name: 'Development', max: 20000 },
{ name: 'Marketing', max: 20000 }
]
},
legend: {
left: 'center',
bottom: '10',
data: ['Allocated Budget', 'Expected Spending', 'Actual Spending']
},
series: [{
type: 'radar',
symbolSize: 0,
areaStyle: {
normal: {
shadowBlur: 13,
shadowColor: 'rgba(0,0,0,.2)',
shadowOffsetX: 0,
shadowOffsetY: 10,
opacity: 1
}
},
data: [
{
value: [5000, 7000, 12000, 11000, 15000, 14000],
name: 'Allocated Budget'
},
{
value: [4000, 9000, 15000, 15000, 13000, 11000],
name: 'Expected Spending'
},
{
value: [5500, 11000, 12000, 15000, 12000, 12000],
name: 'Actual Spending'
}
],
animationDuration: animationDuration
}]
})
}
}
}
</script>
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
const animationDuration = 3000
export default {
name: "Sunburst",
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null,
datas:[
{
name: 'Flora',
itemStyle: {
color: '#da0d68'
},
children: [{
name: 'Black Tea',
value: 1,
itemStyle: {
color: '#975e6d'
}
}, {
name: 'Floral',
itemStyle: {
color: '#e0719c'
},
children: [{
name: 'Chamomile',
value: 1,
itemStyle: {
color: '#f99e1c'
}
}, {
name: 'Rose',
value: 1,
itemStyle: {
color: '#ef5a78'
}
}, {
name: 'Jasmine',
value: 1,
itemStyle: {
color: '#f7f1bd'
}
}]
}]
},
{
name: 'Fruity',
itemStyle: {
color: '#da1d23'
},
children: [{
name: 'Berry',
itemStyle: {
color: '#dd4c51'
},
children: [{
name: 'Blackberry',
value: 1,
itemStyle: {
color: '#3e0317'
}
}, {
name: 'Raspberry',
value: 1,
itemStyle: {
color: '#e62969'
}
}, {
name: 'Blueberry',
value: 1,
itemStyle: {
color: '#6569b0'
}
}, {
name: 'Strawberry',
value: 1,
itemStyle: {
color: '#ef2d36'
}
}]
}, {
name: 'Dried Fruit',
itemStyle: {
color: '#c94a44'
},
children: [{
name: 'Raisin',
value: 1,
itemStyle: {
color: '#b53b54'
}
}, {
name: 'Prune',
value: 1,
itemStyle: {
color: '#a5446f'
}
}]
}, {
name: 'Other Fruit',
itemStyle: {
color: '#dd4c51'
},
children: [{
name: 'Coconut',
value: 1,
itemStyle: {
color: '#f2684b'
}
}, {
name: 'Cherry',
value: 1,
itemStyle: {
color: '#e73451'
}
}, {
name: 'Pomegranate',
value: 1,
itemStyle: {
color: '#e65656'
}
}, {
name: 'Pineapple',
value: 1,
itemStyle: {
color: '#f89a1c'
}
}, {
name: 'Grape',
value: 1,
itemStyle: {
color: '#aeb92c'
}
}, {
name: 'Apple',
value: 1,
itemStyle: {
color: '#4eb849'
}
}, {
name: 'Peach',
value: 1,
itemStyle: {
color: '#f68a5c'
}
}, {
name: 'Pear',
value: 1,
itemStyle: {
color: '#baa635'
}
}]
}, {
name: 'Citrus Fruit',
itemStyle: {
color: '#f7a128'
},
children: [{
name: 'Grapefruit',
value: 1,
itemStyle: {
color: '#f26355'
}
}, {
name: 'Orange',
value: 1,
itemStyle: {
color: '#e2631e'
}
}, {
name: 'Lemon',
value: 1,
itemStyle: {
color: '#fde404'
}
}, {
name: 'Lime',
value: 1,
itemStyle: {
color: '#7eb138'
}
}]
}]
},
{
name: 'Other',
itemStyle: {
color: '#0aa3b5'
},
children: [{
name: 'Papery/Musty',
itemStyle: {
color: '#9db2b7'
},
children: [{
name: 'Stale',
value: 1,
itemStyle: {
color: '#8b8c90'
}
}, {
name: 'Cardboard',
value: 1,
itemStyle: {
color: '#beb276'
}
}, {
name: 'Papery',
value: 1,
itemStyle: {
color: '#fefef4'
}
}, {
name: 'Woody',
value: 1,
itemStyle: {
color: '#744e03'
}
}, {
name: 'Moldy/Damp',
value: 1,
itemStyle: {
color: '#a3a36f'
}
}, {
name: 'Musty/Dusty',
value: 1,
itemStyle: {
color: '#c9b583'
}
}, {
name: 'Musty/Earthy',
value: 1,
itemStyle: {
color: '#978847'
}
}, {
name: 'Animalic',
value: 1,
itemStyle: {
color: '#9d977f'
}
}, {
name: 'Meaty Brothy',
value: 1,
itemStyle: {
color: '#cc7b6a'
}
}, {
name: 'Phenolic',
value: 1,
itemStyle: {
color: '#db646a'
}
}]
}, {
name: 'Chemical',
itemStyle: {
color: '#76c0cb'
},
children: [{
name: 'Bitter',
value: 1,
itemStyle: {
color: '#80a89d'
}
}, {
name: 'Salty',
value: 1,
itemStyle: {
color: '#def2fd'
}
}, {
name: 'Medicinal',
value: 1,
itemStyle: {
color: '#7a9bae'
}
}, {
name: 'Petroleum',
value: 1,
itemStyle: {
color: '#039fb8'
}
}, {
name: 'Skunky',
value: 1,
itemStyle: {
color: '#5e777b'
}
}, {
name: 'Rubber',
value: 1,
itemStyle: {
color: '#120c0c'
}
}]
}]
},
]
}
},
mounted() {
this.initChart()
/* this.__resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize()
}
}, 100)
window.addEventListener('resize', this.__resizeHandler)*/
},
beforeDestroy() {
if (!this.chart) {
return
}
// window.removeEventListener('resize', this.__resizeHandler)
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({
series: {
type: 'sunburst',
highlightPolicy: 'ancestor',
data: this.datas,
radius: [0, '95%'],
sort: null,
levels: [{}, {
r0: '15%',
r: '35%',
itemStyle: {
borderWidth: 2
},
label: {
rotate: 'tangential'
}
}, {
r0: '35%',
r: '70%',
label: {
align: 'right'
}
}, {
r0: '70%',
r: '72%',
label: {
position: 'outside',
padding: 3,
silent: false
},
itemStyle: {
borderWidth: 3
}
}]
},
animationDuration: animationDuration
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="container">
<ul class="moon">
<li class="crater"></li>
<li class="crater"></li>
<li class="crater"></li>
</ul>
<ul class="mountain-range">
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
<li class="mountain"></li>
</ul>
<div class="mountain-range-mask"></div>
<ul class="forest">
<li class="hill"></li>
<li class="hill"></li>
<li class="hill"></li>
</ul>
<ul class="sparkles">
<li class="sparkle one"></li>
<li class="sparkle one"></li>
<li class="sparkle one"></li>
<li class="sparkle one"></li>
<li class="sparkle two"></li>
<li class="sparkle two"></li>
<li class="sparkle two"></li>
<li class="sparkle two"></li>
<li class="sparkle three"></li>
<li class="sparkle three"></li>
<li class="sparkle three"></li>
<li class="sparkle three"></li>
<li class="sparkle four"></li>
<li class="sparkle four"></li>
<li class="sparkle four"></li>
<li class="sparkle four"></li>
<li class="sparkle five"></li>
<li class="sparkle five"></li>
<li class="sparkle five"></li>
<li class="sparkle five"></li>
<li class="sparkle six"></li>
<li class="sparkle six"></li>
<li class="sparkle six"></li>
<li class="sparkle six"></li>
<li class="sparkle seven"></li>
<li class="sparkle seven"></li>
<li class="sparkle seven"></li>
<li class="sparkle seven"></li>
<li class="sparkle eight"></li>
<li class="sparkle eight"></li>
<li class="sparkle eight"></li>
<li class="sparkle eight"></li>
</ul>
<div class="grass">
<div class="pokemon">
<div class="poke" id="bulbasaur">
<div class="ear"></div>
<div class="ear"></div>
<div class="head"></div>
<div class="leg"></div>
<div class="bulba-body"></div>
<div class="bulbs">
<div class="bulb"></div>
</div>
</div>
<div class="poke" id="pikachu">
<div class="ear"></div>
<div class="ear"></div>
<div class="hand"></div>
<div class="pika-body"></div>
<div class="head"></div>
<div class="pika-tail"></div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Animition'
}
</script>
<style lang="scss">
@import '@/style/animition.scss';
</style>
\ No newline at end of file
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
const animationDuration = 3000
export default {
name: "stackMap",
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
}
},
data() {
return {
chart: null
}
},
mounted() {
this.initChart()
/* this.__resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize()
}
}, 100)
window.addEventListener('resize', this.__resizeHandler)*/
},
beforeDestroy() {
if (!this.chart) {
return
}
// window.removeEventListener('resize', this.__resizeHandler)
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'light')
this.chart.setOption({
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
data: ['Javascript', 'Java', 'Python', 'Ruby', 'PHP']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type: 'value',
axisLabel: {
show: true,
textStyle: {
color: 'rgb(192,192,192)', //更改坐标轴文字颜色
fontSize : 12 //更改坐标轴文字大小
}
},
axisTick: {
show: false
},
axisLine:{
lineStyle:{
color:'rgb(192,192,192)' //更改坐标轴颜色
}
},
},
yAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wen', 'Thu', 'Fri', 'Sat', 'Sun'],
axisLabel: {
show: true,
textStyle: {
color: 'rgb(192,192,192)', //更改坐标轴文字颜色
fontSize: 12 //更改坐标轴文字大小
}
},
axisTick: {
show: false
},
axisLine: {
lineStyle: {
color: 'rgb(192,192,192)' //更改坐标轴颜色
}
}
},
series: [
{
name: 'Javascript',
type: 'bar',
stack: '总量',
label: {
show: true,
position: 'insideRight'
},
data: [320, 302, 301, 334, 390, 330, 320]
},
{
name: 'Java',
type: 'bar',
stack: '总量',
label: {
show: true,
position: 'insideRight'
},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: 'Python',
type: 'bar',
stack: '总量',
label: {
show: true,
position: 'insideRight'
},
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: 'Ruby',
type: 'bar',
stack: '总量',
label: {
show: true,
position: 'insideRight'
},
data: [150, 212, 201, 154, 190, 330, 410]
},
{
name: 'PHP',
type: 'bar',
stack: '总量',
label: {
show: true,
position: 'insideRight'
},
data: [820, 832, 901, 934, 1290, 1330, 1320]
}
],
animationDuration: animationDuration
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="big">
<!-- <div class="mid">
<el-row :gutter="32">
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<raddar-chart />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<stackMap />
</div>
</el-col>
<el-col :xs="24" :sm="24" :lg="8">
<div class="chart-wrapper">
<Sunburst/>
</div>
</el-col>
</el-row>
</div> -->
<!-- <div class="top">
<div id="main" class="chart-container"></div>
</div> -->
<div class="card">
<div class="car-left">
<div>
......@@ -87,11 +65,6 @@
</template>
<script>
import echarts from 'echarts'
// require('echarts/theme/macarons') // echarts theme
// import RaddarChart from "./component/RaddarChart"
// import stackMap from "./component/stackMap"
// import Sunburst from "./component/Sunburst"
import musicPlayer from "./component/musicPlayer"
import TodoList from "./component/todoList"
import { mapGetters } from 'vuex'
......
......@@ -117,7 +117,7 @@
<el-tag type="danger">id , created_at , updated_at , deleted_at 会自动生成请勿重复创建</el-tag>
<!-- 组件列表 -->
<div class="button-box clearflex">
<el-button @click="enterForm" type="primary">生成代码</el-button>
<el-button @click="enterForm" type="primary">生成代码</el-button>
</div>
<!-- 组件弹窗 -->
<el-dialog title="组件内容" :visible.sync="dialogFlag">
......@@ -140,7 +140,7 @@ const fieldTemplate = {
dataTypeLong: "",
comment: "",
fieldSearchType: "",
dictType:""
dictType: ""
};
import FieldDialog from "@/view/systemTools/autoCode/component/fieldDialog.vue";
......@@ -278,8 +278,13 @@ export default {
return false;
}
const data = await createTemp(this.form);
if(data.headers?.success == "false"){
return
if (data.headers?.success == "false") {
return;
} else {
this.$message({
type: "success",
message: "自动化代码创建成功,正在下载"
});
}
const blob = new Blob([data]);
const fileName = "ginvueadmin.zip";
......@@ -342,14 +347,14 @@ export default {
columnName: item.columnName,
comment: item.columnComment,
fieldSearchType: "",
dictType:""
dictType: ""
});
}
});
}
},
async setFdMap() {
const fdTypes= ["string", "int", "bool", "float64", "time.Time"];
const fdTypes = ["string", "int", "bool", "float64", "time.Time"];
fdTypes.map(async fdtype => {
const res = await getDict(fdtype);
res.map(item => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册