费用管理

master
lzq 2026-03-03 11:05:47 +08:00
parent db70664f18
commit 572a7aba84
3 changed files with 34 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import {
get,
post
post,
} from '@/common/utils/http-util.ts'
export default {
@ -19,4 +19,7 @@ export default {
del(ids: string[]) {
return post('/station/del', ids)
},
listAll() {
return get<StationTypes.SearchStationResult[]>('/station/list_all')
},
}

View File

@ -20,6 +20,17 @@
<ElFormItem v-else label="项目名称" prop="expenseItemName">
<ElInput v-model="formData.expenseItemName" placeholder="项目名称"/>
</ElFormItem>
<ElFormItem v-if="appUserStore.isXiaoNa" label="站点" prop="stationId">
<ElSelect v-model="formData.stationId" clearable>
<ElOption
v-for="item in stations"
:key="item.id"
:label="item.stationName"
:value="item.id!"/>
</ElSelect>
</ElFormItem>
<ElFormItem label="计费策略" prop="expenseStrategy">
<ElRadioGroup v-model="formData.expenseStrategy">
<ElRadio v-for="it in expenseStrategy" :key="'expenseStrategy'+it.val" :value="it.val" border>{{ it.txt }}</ElRadio>
@ -86,6 +97,8 @@ import {
} from '@/pages/gds/goods/constants.ts'
import { expenseItemCategory } from '@/pages/fin/expense-item/constants.ts'
import GoodsDropTable from '@/pages/gds/goods/GoodsDropTable.vue'
import { useAppUserStore } from '@/common/app/app-user-store.ts'
import StationApi from '@/pages/cst/station/station-api.ts'
const props = withDefaults(defineProps<{
research?: () => void
@ -93,6 +106,7 @@ const props = withDefaults(defineProps<{
research: () => {
},
})
const appUserStore = useAppUserStore()
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemResult>({
@ -115,11 +129,11 @@ const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemRes
doSubmit(data) {
if (status.value === 'add') {
return ExpenseItemApi
.add(data)
.add({...data, stationId: appUserStore.isXiaoNa ? data.stationId : undefined})
.then(props.research)
} else {
return ExpenseItemApi
.modify(data)
.modify({...data, stationId: appUserStore.isXiaoNa ? data.stationId : undefined})
.then(props.research)
}
},
@ -144,8 +158,18 @@ const formPanelProps = buildFormPanelProps<ExpenseItemTypes.SearchExpenseItemRes
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建收费项目' : '修改收费项目信息'
})
const stations = ref<StationTypes.SearchStationResult[]>([])
defineExpose({
open(data?: ExpenseItemTypes.SearchExpenseItemResult) {
if (appUserStore.isXiaoNa) {
StationApi.listAll()
.then(res => {
stations.value = res.data
})
} else {
stations.value = []
}
formPanelIns.value?.open(data?.id)
},
})

View File

@ -5,6 +5,7 @@ declare global {
interface SearchExpenseItemParam extends G.PageParam {
// Id
id?: string
stationId?: string
// 归属用户 Id
userId?: string
// 归属客户 Id
@ -52,6 +53,7 @@ declare global {
id?: string
// 归属用户 Id
userId?: string
stationId?: string
// 归属客户 Id
customerId?: string
// 归属组织 Id
@ -97,6 +99,7 @@ declare global {
id?: string
// 归属用户 Id
userId?: string
stationId?: string
// 归属客户 Id
customerId?: string
// 归属组织 Id
@ -140,6 +143,7 @@ declare global {
interface ModifyExpenseItemParam {
// Id
id?: string
stationId?: string
// 归属用户 Id
userId?: string
// 归属客户 Id