import dataRdb from '@ohos.data.rdb'
import router from '@system.router';
export default {
data: {
points: [],
lineData: [],
lineOps: {
xAxis: {
min: 0,
max: 12,
axisTick: 13,
display: true,
color: '#ffff0000'
},
yAxis: {
min: 0,
max: 10000,
axisTick: 5,
display: true,
color: '#ffff0000'
},
series: {
lineStyle: {
width: "2px",
smooth: true,
},
headPoint: {
shape: "circle",
size: 10,
strokeWidth: 2,
fillColor: '#ffffff',
strokeColor: '#007aff',
display: true,
},
loop: {
margin: 2,
gradient: true,
}
}
},
txtTips: ['月账汇总', '收入管理', '支出管理', '记账设置'],
noteType: ['收入', '支出'],
info: '月账汇总',
cIndex: 0,
rtypes: [
{
mainName: '职业收入', subName: '工资收入'
},
{
mainName: '职业收入', subName: '资金收入'
},
{
mainName: '职业收入', subName: '劳务收入'
},
{
mainName: '其他收入', subName: '礼金收入'
},
{
mainName: '其他收入', subName: '投资收入'
},
], //保存收入类别设置信息
ztypes: [
{
mainName: '衣服饰品', subName: '衣服裤子'
},
{
mainName: '衣服饰品', subName: '鞋帽包包'
},
{
mainName: '衣服饰品', subName: '化妆饰品'
},
{
mainName: '食品酒水', subName: '菜品调料'
},
{
mainName: '食品酒水', subName: '早午晚餐'
},
{
mainName: '食品酒水', subName: '烟酒茶水'
},
{
mainName: '食品酒水', subName: '水果零食'
},
{
mainName: '居家物业', subName: '日常用品'
},
{
mainName: '居家物业', subName: '房租水电'
},
{
mainName: '居家物业', subName: '维修保养'
},
{
mainName: '其他杂项', subName: '人情送往'
},
{
mainName: '其他杂项', subName: '其他支出'
},
], //保存支出类别信息设置
mainName: '', //保存输入的一级类别
subName: '', //保存输入的二级类别
flag: false,
notepadDB: '', //保存打开的数据库
rmanager: [], //保存收入管理页面一级类别
rmanagerdetail: [], //保存收入管理页面一级类别和二级类别信息
ramount: '', //保存输入的金额
rdate: '2020-09-09', //保存输入的金额
rmemo: '', //保存输入的备注
index: 0, //当前类别下标
ramounts: [50000, 5000, 4000, 6000, 7000, 5670, 3420, 8760, 7600, 8900, 7600, 3450], //月收入汇总
},
/*定义创建表方法*/
createTB(rdbStore, SQL_CREATE_TABLE) {
rdbStore.executeSql(SQL_CREATE_TABLE, null).then(() => {
console.info("创建表成功")
}).catch((err) => {
console.info("创建表失败" + err)
})
},
/*定义插入表记录方法*/
insertRecord(db, tbName, valueBucket) {
db.insert(tbName, valueBucket).then((ret) => {
console.info("当前插入的记录ID: " + ret)
}).catch((err) => {
console.info("插入记录失败: " + err)
})
},
//初始化线形图数据
initData(mamounts) {
this.points = []
for (var i = 0;i < 12; i++) {
var pvalue = mamounts[i]
this.points.push(
{
value: pvalue,
pointStyle: {
shape: "circle",
size: 10,
strokeWidth: 2,
fillColor: '#ffffff',
strokeColor: '#007aff',
display: true,
},
description: pvalue + '',
textLocation: 'top',
textColor: '#ffff00ff'
})
}
this.lineData = [
{
strokeColor: '#0081ff',
fillColor: '#cce5ff',
data: this.points,
gradient: true
}
]
},
async onInit() {
this.initData(this.ramounts)
var date = new Date() //获取当前日期
this.rdate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() //按年-月-日格式显示当前日期
var that = this
const MALES_CONFIG = {
name: "notepad.db" //数据库名称
}
await dataRdb.getRdbStore(MALES_CONFIG, 1).then((rdbStore) => {
console.info("创建数据库成功:")
//创建收入类别表rtable
var SQL_CREATE_TABLE = "create table if not exists rtable(id integer primary key autoincrement,mainName text not null,subName text not null)"
that.createTB(rdbStore, SQL_CREATE_TABLE) //创建收入类别表
//创建支出类别表ztable
SQL_CREATE_TABLE = "create table if not exists ztable(id integer primary key autoincrement,mainName text not null,subName text not null)"
that.createTB(rdbStore, SQL_CREATE_TABLE) //创建支出类别表
SQL_CREATE_TABLE = "create table if not exists rdetail(id integer primary key autoincrement,mainName text not null,subName text not null,amount float,rq text,memo text)"
that.createTB(rdbStore, SQL_CREATE_TABLE) //创建收入明细表
SQL_CREATE_TABLE = "create table if not exists zdetail(id integer primary key autoincrement,mainName text not null,subName text not null,amount float,rq text,memo text)"
that.createTB(rdbStore, SQL_CREATE_TABLE) //创建支出明细表
that.notepadDB = rdbStore
}).catch((err) => {
console.info("创建数据库失败:" + err)
});
},
/*定义切换tab事件*/
async changeTab(value) {
this.rmanager = []
this.rmanagerdetail = []
this.info = this.txtTips[value]
this.cIndex = value
switch (value) {
case 0:
var detail = []
var amounts = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
await this.viewDetail("rDetail", detail)
for (var i = 0;i < detail.length; i++) {
var month = new Date(detail[i].rq).getMonth()
amounts[month] = amounts[month] + detail[i].amount
}
for (var i = 0;i < amounts.length; i++) {
console.info("amounts" + i + ":" + amounts[i])
}
this.initData(amounts)
break
case 1:
//从入账类别表中读出一级类别信息
await this.viewMarray('rtable', this.rmanager)
for (var i = 0;i < this.rmanager.length; i++) {
console.info("一级类别" + this.rmanager[i])
}
//从入账类别表中读出一级类别、二级类别信息
await this.viewRecord('
没有合适的资源?快使用搜索试试~ 我知道了~
第五章代码.zip
共152个文件
js:43个
css:42个
hml:42个
需积分: 0 0 下载量 45 浏览量
2024-05-27
15:05:29
上传
评论
收藏 1.91MB ZIP 举报
温馨提示
第五章代码.zip
资源推荐
资源详情
资源评论
收起资源包目录
第五章代码.zip (152个子文件)
notetaking.css 2KB
index.css 886B
p_5_14.css 885B
lottery.css 697B
p_5_33.css 650B
p_5_32.css 650B
question.css 606B
setup.css 551B
p_5_12.css 546B
detail.css 529B
p_list.css 528B
report.css 510B
healthApp.css 457B
p_refresh.css 435B
p_5_11.css 409B
p_5_1.css 319B
p_5_15.css 304B
p_submit.css 276B
p_5_31.css 275B
p_5_41.css 261B
p_test.css 248B
p_5_28.css 248B
p_order.css 248B
p_msg.css 248B
p_order.css 248B
p_msg.css 248B
p_success.css 245B
p_5_10.css 245B
p_5_30.css 218B
p_5_9.css 218B
p_5_27.css 210B
p_5_42.css 167B
p_5_26.css 153B
p_5_34.css 152B
p_finish.css 150B
p_5_5.css 140B
p_5_4.css 140B
p_5_2.css 140B
p_5_3.css 140B
p_distributedData.css 124B
p_5_23.css 123B
p_5_25.css 97B
notetaking.hml 6KB
p_5_33.hml 3KB
p_5_32.hml 3KB
question.hml 2KB
setup.hml 1KB
lottery.hml 1KB
p_5_14.hml 1KB
p_5_15.hml 1KB
p_5_11.hml 1KB
p_5_31.hml 1KB
p_5_12.hml 1004B
p_distributedData.hml 840B
healthApp.hml 824B
p_5_5.hml 820B
detail.hml 719B
p_5_27.hml 620B
p_5_9.hml 609B
p_test.hml 608B
p_list.hml 596B
p_5_34.hml 576B
index.hml 519B
report.hml 458B
p_5_42.hml 425B
p_5_4.hml 403B
p_5_30.hml 386B
p_refresh.hml 385B
p_5_26.hml 352B
p_5_28.hml 345B
p_5_41.hml 334B
p_5_25.hml 309B
p_submit.hml 277B
p_5_23.hml 266B
p_finish.hml 257B
p_5_10.hml 248B
p_5_3.hml 238B
p_5_1.hml 208B
p_5_2.hml 168B
p_success.hml 139B
p_order.hml 94B
p_order.hml 94B
p_msg.hml 87B
p_msg.hml 87B
sport3.jpeg 406KB
sport9.jpeg 127KB
sport5.jpeg 79KB
sport8.jpeg 49KB
sport1.jpeg 41KB
sport4.jpeg 32KB
sport7.jpeg 29KB
sport2.jpeg 26KB
sport6.jpeg 22KB
bg-tv.jpg 210KB
notetaking.js 14KB
p_5_15.js 8KB
p_5_34.js 7KB
lottery.js 6KB
question.js 5KB
p_distributedData.js 5KB
共 152 条
- 1
- 2
资源评论
2401_84459357
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功