feat: update VSCode settings for ESLint and Prettier integration
chore: refactor ESLint configuration for improved linting rules and performance fix: handle push event data parsing in service worker style: adjust tabbar item properties for better readability in App.vue refactor: remove unused functions and improve code clarity in TransactionDetail.vue fix: ensure consistent event handling in CalendarView.vue style: clean up component structure and formatting in various Vue files chore: update launch script for better command execution feat: add ESLint configuration file for consistent code style across the project fix: resolve issues with button click events in multiple components
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
:title="navTitle"
|
||||
left-text="返回"
|
||||
left-arrow
|
||||
@click-left="handleBack"
|
||||
placeholder
|
||||
placeholder
|
||||
@click-left="handleBack"
|
||||
/>
|
||||
|
||||
<!-- 下拉刷新区域 -->
|
||||
@@ -20,10 +20,10 @@
|
||||
v-model:loading="loading"
|
||||
:finished="finished"
|
||||
finished-text="没有更多了"
|
||||
@load="onLoad"
|
||||
class="periodic-list"
|
||||
@load="onLoad"
|
||||
>
|
||||
<van-cell-group inset v-for="item in periodicList" :key="item.id" class="periodic-item">
|
||||
<van-cell-group v-for="item in periodicList" :key="item.id" inset class="periodic-item">
|
||||
<van-swipe-cell>
|
||||
<div @click="editPeriodic(item)">
|
||||
<van-cell :title="item.reason || '无摘要'" :label="getPeriodicTypeText(item)">
|
||||
@@ -99,8 +99,8 @@
|
||||
name="periodicType"
|
||||
label="周期"
|
||||
placeholder="请选择周期类型"
|
||||
@click="showPeriodicTypePicker = true"
|
||||
:rules="[{ required: true, message: '请选择周期类型' }]"
|
||||
@click="showPeriodicTypePicker = true"
|
||||
/>
|
||||
|
||||
<!-- 每周配置 -->
|
||||
@@ -112,8 +112,8 @@
|
||||
name="weekdays"
|
||||
label="星期"
|
||||
placeholder="请选择星期几"
|
||||
@click="showWeekdaysPicker = true"
|
||||
:rules="[{ required: true, message: '请选择星期几' }]"
|
||||
@click="showWeekdaysPicker = true"
|
||||
/>
|
||||
|
||||
<!-- 每月配置 -->
|
||||
@@ -125,8 +125,8 @@
|
||||
name="monthDays"
|
||||
label="日期"
|
||||
placeholder="请选择每月的日期"
|
||||
@click="showMonthDaysPicker = true"
|
||||
:rules="[{ required: true, message: '请选择日期' }]"
|
||||
@click="showMonthDaysPicker = true"
|
||||
/>
|
||||
|
||||
<!-- 每季度配置 -->
|
||||
@@ -225,7 +225,7 @@
|
||||
</van-cell-group>
|
||||
</van-form>
|
||||
<template #footer>
|
||||
<van-button round block type="primary" @click="submit" :loading="submitting">
|
||||
<van-button round block type="primary" :loading="submitting" @click="submit">
|
||||
{{ isEdit ? '更新' : '确认添加' }}
|
||||
</van-button>
|
||||
</template>
|
||||
@@ -267,13 +267,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { showToast, showConfirmDialog } from 'vant'
|
||||
import {
|
||||
getPeriodicList,
|
||||
createPeriodic,
|
||||
updatePeriodic,
|
||||
deletePeriodic as deletePeriodicApi,
|
||||
togglePeriodicEnabled
|
||||
} from '@/api/transactionPeriodic'
|
||||
@@ -643,80 +641,6 @@ const handleAddClassify = async (categoryName) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 提交表单
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
submitting.value = true
|
||||
|
||||
// 构建周期配置
|
||||
let periodicConfig = ''
|
||||
switch (form.periodicType) {
|
||||
case 1: // 每周
|
||||
if (!form.weekdays.length) {
|
||||
showToast('请选择星期几')
|
||||
return
|
||||
}
|
||||
periodicConfig = form.weekdays.join(',')
|
||||
break
|
||||
case 2: // 每月
|
||||
if (!form.monthDays.length) {
|
||||
showToast('请选择日期')
|
||||
return
|
||||
}
|
||||
periodicConfig = form.monthDays.join(',')
|
||||
break
|
||||
case 3: // 每季度
|
||||
if (!form.quarterDay) {
|
||||
showToast('请输入季度开始后第几天')
|
||||
return
|
||||
}
|
||||
periodicConfig = form.quarterDay
|
||||
break
|
||||
case 4: // 每年
|
||||
if (!form.yearDay) {
|
||||
showToast('请输入年开始后第几天')
|
||||
return
|
||||
}
|
||||
periodicConfig = form.yearDay
|
||||
break
|
||||
}
|
||||
|
||||
const data = {
|
||||
periodicType: form.periodicType,
|
||||
periodicConfig: periodicConfig,
|
||||
amount: parseFloat(form.amount),
|
||||
type: form.type,
|
||||
classify: form.classify || '',
|
||||
reason: form.reason || ''
|
||||
}
|
||||
|
||||
let response
|
||||
if (isEdit.value) {
|
||||
data.id = form.id
|
||||
data.isEnabled = true
|
||||
response = await updatePeriodic(data)
|
||||
} else {
|
||||
response = await createPeriodic(data)
|
||||
}
|
||||
|
||||
if (response.success) {
|
||||
showToast(isEdit.value ? '更新成功' : '添加成功')
|
||||
dialogVisible.value = false
|
||||
loadData(true)
|
||||
} else {
|
||||
showToast(response.message || (isEdit.value ? '更新失败' : '添加失败'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提交出错:', error)
|
||||
showToast((isEdit.value ? '更新' : '添加') + '失败')
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
// van-list 会自动触发 onLoad
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user