项目开发记录:销售管理系统+数据可视化分析 开发笔记
发布日期:2021-04-30 21:06:46
浏览次数:88
分类:精选文章
本文共 7293 字,大约阅读时间需要 24 分钟。
??????+??????? ????
????
?????SpringBoot+Vue??????????????????????????????????????????????????????????B?UP??????????????
????
[???????]
??????
1. ????
- ????
npm install axiosnpm install element-ui -Snpm install echarts --save
- ????
import ElementUI from 'element-ui';import 'element-ui/lib/theme-chalk/index.css';Vue.use(ElementUI);import axios from 'axios';Vue.prototype.$axios = axios;import echarts from 'echarts';Vue.prototype.$echarts = echarts;
2. ????
- ???
- ??????????????????
- ?????????
- ?????????
- ??
???? ?? - ??
export default { name: "Edit", data() { return { fruit: { name: '', sale: '', icon: '' }, rules: { name: [ { required: true, message: '???????', trigger: 'blur' } ], sale: [ { required: true, message: '?????', trigger: 'blur' }, { type: 'number', message: '????????' } ], icon: [ { required: true, message: '???????', trigger: 'blur' } ] } } }, created() { let id = this.$route.query.id; let _this = this; this.$axios.get('http://localhost:8081/fruit/find/' + id).then(function(response) { _this.fruit = response.data; }); }, methods: { onSubmit(formName) { this.$refs[formName].validate((valid) => { if (valid) { let _this = this; this.$axios.put('http://localhost:8081/fruit/update', this.fruit).then(function(response) { if(response.data) { _this.$alert(_this.fruit.name + '?????', '????', { confirmButtonText: '??', callback: action => { _this.$router.push('/table'); } }); } }); } }); } }}
3. ???
- ???
- ????????????
- ?????????????
- ??
fruitDelete(object) { let _this = this; this.$confirm('???????' + object.name + '?', '????', { confirmButtonText: '??', cancelButtonText: '??', type: 'warning' }).then(() => { this.$axios.delete('http://localhost:8081/fruit/delete/' + object.id).then(function(response) { if (response.data) { _this.$alert(object.name + '?????', '????', { confirmButtonText: '??', callback: action => { location.reload(); } }); } }); }).catch(() => { });}
4. ???
- ???
- ?????????
- ??
- ??
export default { mounted() { let _this = this; this.$axios.get('http://localhost:8081/fruit/barVO').then(function(response) { let myChart = _this.$echarts.init(document.getElementById('myChart')); myChart.setOption({ title: { text: 'XX??', left: 'center', top: 20, textStyle: { color: '#555555' } }, tooltip: {}, xAxis: { data: response.data.names }, yAxis: {}, series: [{ name: '??', type: 'bar', data: response.data.values }] }); }); }}
??????
1. ????
- ??
package com.lut.configuration;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.CorsRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;@Configurationpublic class CrosConfiguration implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOriginPatterns("*") .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS") .allowCredentials(true) .maxAge(3600) .allowedHeaders("*"); }}
2. ?????
- ????
package com.lut;import com.baomidou.mybatisplus.annotation.DbType;import com.baomidou.mybatisplus.generator.AutoGenerator;import com.baomidou.mybatisplus.generator.config.DataSourceConfig;import com.baomidou.mybatisplus.generator.config.GlobalConfig;import com.baomidou.mybatisplus.generator.config.PackageConfig;import com.baomidou.mybatisplus.generator.config.StrategyConfig;import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;public class GenerateTest { public static void main(String[] args) { AutoGenerator autoGenerator = new AutoGenerator(); DataSourceConfig dataSourceConfig = new DataSourceConfig(); dataSourceConfig.setDbType(DbType.MYSQL); dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver"); dataSourceConfig.setUsername("root"); dataSourceConfig.setPassword("88888888"); dataSourceConfig.setUrl("jdbc:mysql://localhost:3306/test"); autoGenerator.setDataSource(dataSourceConfig); GlobalConfig globalConfig = new GlobalConfig(); globalConfig.setOutputDir(System.getProperty("user.dir") + "/src/main/java"); globalConfig.setAuthor("admin"); globalConfig.setOpen(false); globalConfig.setServiceName("%sService"); autoGenerator.setGlobalConfig(globalConfig); PackageConfig packageConfig = new PackageConfig(); packageConfig.setParent("com.lut.fruit_java"); packageConfig.setEntity("entity"); packageConfig.setMapper("mapper"); packageConfig.setService("service"); packageConfig.setServiceImpl("service.impl"); packageConfig.setController("controller"); autoGenerator.setPackageInfo(packageConfig); StrategyConfig strategyConfig = new StrategyConfig(); strategyConfig.setInclude("fruit"); strategyConfig.setNaming(NamingStrategy.underline_to_camel); strategyConfig.setColumnNaming(NamingStrategy.underline_to_camel); strategyConfig.setEntityLombokModel(true); autoGenerator.setStrategy(strategyConfig); autoGenerator.execute(); }}
3. ????
- spring??
spring: datasource: url: jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8 username: root password: 88888888 driver-class-name: com.mysql.cj.jdbc.Drivermybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl mapper-locations: classpath:com/southwind/mapper/xml/*.xmlserver: port: 8081
4. ????
- VO?
public class BarVO { private Listnames; private List values;} - DataVO?
public class DataVO { private Integer value; private MapitemStyle;} - PieVO?
public class PieVO { private Integer value; private MapitemStyle; private String name;} - REST??
@GetMapping("/barVO")public BarVO barVO() { return this.fruitService.barVOList();}@GetMapping("/pieVO")public ListpieVOList() { return this.fruitService.pieVOList();}
??BUG??
BUG1?axios is not defined
- ????
[Vue warn]: Error in created hook: "ReferenceError: axios is not defined"
- ????
import VueAxios from 'vue-axios';import axios from 'axios';Vue.prototype.$axios = axios;
???main.js?????axios?
BUG2????????
- ????
???????????? ???
- ????
spring.datasource.url=jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8
??????URL???useUnicode?characterEncoding???
发表评论
最新留言
哈哈,博客排版真的漂亮呢~
[***.90.31.176]2026年05月30日 15时44分49秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
PHP7中十个需要避免的坑
2023-02-28
php7和PHP5对比的新特性和性能优化
2023-02-28
PHP7安装pdo_mysql扩展
2023-02-28
PHP7实战开发简单CMS内容管理系统(7) 后台登录架构 用户登录校验
2023-02-28
php7,从phpExcel升级到PhpSpreadsheet
2023-02-28
PHP8中match新语句的操作方法
2023-02-28
PHP:第一章——PHP中常量和预定义常量
2023-02-28
PHP:第一章——PHP中的位运算
2023-02-28
phpcms
2023-02-28
phpcms 2008 product.php pagesize参数代码注射漏洞
2023-02-28
phpcms V9 自定义添加 全局变量{DIY_PATH}方法
2023-02-28
Redis五种核心数据结构的基本使用与应用场景
2023-02-28
PHPCMS多文件上传和上传数量限制
2023-02-28
phpEnv的PHP集成环境
2023-02-28
PHPExcel一些基本设置总结
2023-02-28
PHPExcel导入导出 若在thinkPHP3.2中使用(无论实例还是静态调用(如new classname或classname::function)都必须加反斜杠,因3.2就命名空间,如/c...
2023-02-28
PHPMailer发送邮件
2023-02-28
phpmailer发送邮件,可以带附件
2023-02-28
phpmyadmin 安装
2023-02-28
phpmyadmin数据库建表及插入
2023-02-28