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