fix: 自测问题,彻底解决。
This commit is contained in:
@@ -211,132 +211,123 @@ onLoad((option) => {
|
||||
childCategoryList.value =[res.data]
|
||||
})
|
||||
|
||||
// 如果有储蓄卡类型,先设置查询参数
|
||||
if (tempDebitType.value) {
|
||||
queryAccountParams.value.debitType = tempDebitType.value
|
||||
debitTypeShow.value = true
|
||||
}
|
||||
|
||||
// 设置账户类型查询参数
|
||||
if (form.value.type) {
|
||||
queryAccountParams.value.type = form.value.type
|
||||
}
|
||||
|
||||
listAccounts(queryAccountParams.value).then((response) => {
|
||||
accountNameList.value = [response.rows]
|
||||
|
||||
// 如果有预设的accountId,自动填充账户名称
|
||||
if (form.value.accountId && response.rows.length > 0) {
|
||||
const selectedAccount = response.rows.find(item => item.id === form.value.accountId)
|
||||
if (selectedAccount) {
|
||||
form.value.accountName = selectedAccount.nameCodeAvailableLimit
|
||||
}
|
||||
// 如果没有ID(新增模式)
|
||||
if(form.value.id == null) {
|
||||
// 如果有储蓄卡类型,先设置查询参数
|
||||
if (tempDebitType.value) {
|
||||
queryAccountParams.value.debitType = tempDebitType.value
|
||||
debitTypeShow.value = true
|
||||
}
|
||||
})
|
||||
|
||||
// 如果有储蓄卡类型,回填储蓄卡类型名称
|
||||
if (tempDebitType.value) {
|
||||
getDicts('debit_type').then(result => {
|
||||
tempDebitTypeName.value = dictStr(tempDebitType.value, result.data)
|
||||
|
||||
// 设置账户类型查询参数
|
||||
if (form.value.type) {
|
||||
queryAccountParams.value.type = form.value.type
|
||||
}
|
||||
|
||||
listAccounts(queryAccountParams.value).then((response) => {
|
||||
accountNameList.value = [response.rows]
|
||||
|
||||
// 如果有预设的accountId,自动填充账户名称
|
||||
if (form.value.accountId && response.rows.length > 0) {
|
||||
const selectedAccount = response.rows.find(item => item.id === form.value.accountId)
|
||||
if (selectedAccount) {
|
||||
form.value.accountName = selectedAccount.nameCodeAvailableLimit
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 回填记账类型名称
|
||||
if (form.value.type) {
|
||||
getDicts('account_type').then(result => {
|
||||
form.value.typeName = dictStr(form.value.type, result.data)
|
||||
})
|
||||
}
|
||||
|
||||
// 交易类别
|
||||
getDicts('daily_expenses').then(result => {
|
||||
form.value.childCategoryName=dictStr(form.value.childCategory, result.data)
|
||||
})
|
||||
// 交易类别
|
||||
getDicts('deal_category').then(result => {
|
||||
form.value.dealCategoryName=dictStr(form.value.dealCategory, result.data)
|
||||
})
|
||||
// 记账类型
|
||||
getDicts('account_type').then(result => {
|
||||
form.value.typeName=dictStr(form.value.type, result.data)
|
||||
})
|
||||
// 交易类型
|
||||
getDicts('deal_type').then(result => {
|
||||
form.value.dealTypeName=dictStr(form.value.dealType, result.data)
|
||||
})
|
||||
|
||||
if(form.value.id!=null){
|
||||
|
||||
// 如果有储蓄卡类型,回填储蓄卡类型名称
|
||||
if (tempDebitType.value) {
|
||||
getDicts('debit_type').then(result => {
|
||||
tempDebitTypeName.value = dictStr(tempDebitType.value, result.data)
|
||||
})
|
||||
}
|
||||
|
||||
// 回填记账类型名称
|
||||
if (form.value.type) {
|
||||
getDicts('account_type').then(result => {
|
||||
form.value.typeName = dictStr(form.value.type, result.data)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 编辑或复制模式 - 先加载数据,再处理账户列表
|
||||
getAccountDealRecord(form.value.id).then(res => {
|
||||
form.value = res.data
|
||||
|
||||
// 处理交易子类别显示
|
||||
if (form.value.dealCategory === '1') {
|
||||
childCategoryShow.value = true
|
||||
// 交易类别
|
||||
getDicts('daily_expenses').then(result => {
|
||||
form.value.childCategoryName=dictStr(form.value.childCategory, result.data)
|
||||
})
|
||||
} else {
|
||||
form.value.childCategoryName = form.value.dealCategory
|
||||
form.value.childCategory = form.value.dealCategory
|
||||
childCategoryShow.value = false
|
||||
}
|
||||
// 交易类别
|
||||
getDicts('deal_category').then(result => {
|
||||
form.value.dealCategoryName=dictStr(form.value.dealCategory, result.data)
|
||||
})
|
||||
|
||||
// 记账类型
|
||||
getDicts('account_type').then(result => {
|
||||
form.value.typeName=dictStr(form.value.type, result.data)
|
||||
})
|
||||
// 交易类型
|
||||
childCategoryShow.value = true
|
||||
getDicts('daily_expenses').then(result => {
|
||||
form.value.childCategoryName = dictStr(form.value.childCategory, result.data)
|
||||
})
|
||||
} else {
|
||||
form.value.childCategoryName = form.value.dealCategory
|
||||
form.value.childCategory = form.value.dealCategory
|
||||
childCategoryShow.value = false
|
||||
}
|
||||
|
||||
// 回填各字典标签
|
||||
getDicts('deal_category').then(result => {
|
||||
form.value.dealCategoryName = dictStr(form.value.dealCategory, result.data)
|
||||
})
|
||||
getDicts('account_type').then(result => {
|
||||
form.value.typeName = dictStr(form.value.type, result.data)
|
||||
})
|
||||
getDicts('deal_type').then(result => {
|
||||
form.value.dealTypeName=dictStr(form.value.dealType, result.data)
|
||||
})
|
||||
if(form.value.type=='1'||form.value.type=='2'){
|
||||
queryAccountParams.value.type = form.value.type
|
||||
}
|
||||
else {
|
||||
queryAccountParams.value.type = null
|
||||
}
|
||||
|
||||
// 如果是复制模式,重置交易时间
|
||||
if(flag.value!=null){
|
||||
form.value.createTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
|
||||
}
|
||||
|
||||
// 编辑和复制时,如果是储蓄账户,自动回填储蓄账户类型并显示筛选框
|
||||
if(form.value.type === '1' && form.value.accountId) {
|
||||
debitTypeShow.value = true
|
||||
// 从账户列表中查找当前账户的储蓄账户类型
|
||||
listAccounts({pageNum: 1, pageSize: 1000, type: '1', status: '1'}).then((response) => {
|
||||
const currentAccount = response.rows.find(item => item.id === form.value.accountId)
|
||||
if(currentAccount && currentAccount.debitType) {
|
||||
tempDebitType.value = currentAccount.debitType
|
||||
getDicts('debit_type').then(result => {
|
||||
tempDebitTypeName.value = dictStr(currentAccount.debitType, result.data)
|
||||
})
|
||||
queryAccountParams.value.debitType = currentAccount.debitType
|
||||
// 只筛选匹配储蓄账户类型的账户
|
||||
accountNameList.value = [response.rows.filter(item => item.debitType === tempDebitType.value)]
|
||||
} else {
|
||||
// 如果没有找到储蓄账户类型,显示所有储蓄账户
|
||||
accountNameList.value = [response.rows]
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 非储蓄账户(信用卡等),清除储蓄账户类型筛选条件
|
||||
queryAccountParams.value.debitType = null
|
||||
debitTypeShow.value = false
|
||||
tempDebitType.value = null
|
||||
tempDebitTypeName.value = null
|
||||
// 加载对应类型的账户列表
|
||||
listAccounts(queryAccountParams.value).then((response) => {
|
||||
accountNameList.value = [response.rows]
|
||||
})
|
||||
}
|
||||
form.value.dealTypeName = dictStr(form.value.dealType, result.data)
|
||||
})
|
||||
|
||||
// 如果是复制模式,重置交易时间
|
||||
if(flag.value != null) {
|
||||
form.value.createTime = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
|
||||
}
|
||||
|
||||
// 根据账户类型加载对应的账户列表
|
||||
if(form.value.type === '1') {
|
||||
// 储蓄账户 - 显示储蓄账户类型筛选
|
||||
debitTypeShow.value = true
|
||||
queryAccountParams.value.type = '1'
|
||||
|
||||
// 从账户列表中查找当前账户的储蓄账户类型
|
||||
listAccounts({pageNum: 1, pageSize: 1000, type: '1', status: '1'}).then((response) => {
|
||||
const currentAccount = response.rows.find(item => item.id === form.value.accountId)
|
||||
if(currentAccount && currentAccount.debitType) {
|
||||
tempDebitType.value = currentAccount.debitType
|
||||
queryAccountParams.value.debitType = currentAccount.debitType
|
||||
getDicts('debit_type').then(result => {
|
||||
tempDebitTypeName.value = dictStr(currentAccount.debitType, result.data)
|
||||
})
|
||||
// 只筛选匹配储蓄账户类型的账户
|
||||
accountNameList.value = [response.rows.filter(item => item.debitType === tempDebitType.value)]
|
||||
} else {
|
||||
// 如果没有找到储蓄账户类型,显示所有储蓄账户
|
||||
accountNameList.value = [response.rows]
|
||||
}
|
||||
})
|
||||
} else if(form.value.type === '2') {
|
||||
// 信用卡账户
|
||||
debitTypeShow.value = false
|
||||
tempDebitType.value = null
|
||||
tempDebitTypeName.value = null
|
||||
queryAccountParams.value.type = '2'
|
||||
queryAccountParams.value.debitType = null
|
||||
listAccounts({pageNum: 1, pageSize: 1000, type: '2', status: '1'}).then((response) => {
|
||||
accountNameList.value = [response.rows]
|
||||
})
|
||||
} else {
|
||||
// 其他类型账户
|
||||
debitTypeShow.value = false
|
||||
tempDebitType.value = null
|
||||
tempDebitTypeName.value = null
|
||||
queryAccountParams.value.type = form.value.type
|
||||
queryAccountParams.value.debitType = null
|
||||
listAccounts({pageNum: 1, pageSize: 1000, type: form.value.type, status: '1'}).then((response) => {
|
||||
accountNameList.value = [response.rows]
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
console.log(form.value)
|
||||
}
|
||||
function dictStr(val, arr) {
|
||||
|
||||
Reference in New Issue
Block a user