123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <template>
- <van-row style="margin-top: 20px" @click="dateScreenShow = true">
- <van-col :span="24">
- <van-cell-group>
- <van-cell title="筛选条件" is-link size="large" class="checkCell">
- <template #value>
- <van-text-ellipsis content="内容" class="cellContent"/>
- </template>
- <template #right-icon>
- <van-icon
- class="closeIcon"
- name="close"
- />
- </template>
- </van-cell>
- </van-cell-group>
- </van-col>
- </van-row>
- <van-cell-group>
- <van-cell
- v-for="item in projectCostList"
- :key="item.ID"
- :title="item.user.nickName"
- :label="item.feeTime"
- is-link
- class="costCell"
- @click="openCostDetail(item)"
- >
- <template #value>
- <van-text-ellipsis :content="item.projectFeeGenre.name"/>
- </template>
- </van-cell>
- </van-cell-group>
- <van-popup
- v-model:show="dateScreenShow"
- position="bottom"
- style="height: 70vh"
- closeable
- close-icon-position="top-right"
- >
- <van-row style="margin-top: 8vh">
- <van-col :span="22" :offset="1">
- <el-form label-width="100" label-position="left" size="large">
- <el-form-item label="项目:" size="large">
- <el-select
- placeholder="请选择项目"
- v-model="projectCostBody.projectCode"
- clearable
- @clear="projectCostBody.projectCode = ''"
- >
- <el-option
- v-for="item in projectList"
- :key="item.ID"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="选择器类型:" size="large">
- <el-select placeholder="请选择日期选择器类型" v-model="timeTypeValue">
- <el-option
- v-for="item in dateTypeColumns"
- :key="item.id"
- :label="item.text"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- <el-form-item
- v-if="timeTypeValue === 'day'"
- label="日期:"
- size="large">
- <el-date-picker
- v-model="projectCostBody.dayTime"
- type="date"
- placeholder="请选择日期"
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
- clearable
- @clear="projectCostBody.dayTime = ''"
- />
- </el-form-item>
- <el-form-item
- v-if="timeTypeValue === 'month'"
- label="月份:"
- >
- <el-date-picker
- v-model="projectCostBody.monthTime"
- type="month"
- placeholder="请选择月份"
- format="YYYY-MM"
- value-format="YYYY-MM"
- clearable
- @clear="projectCostBody.monthTime = ''"
- />
- </el-form-item>
- <el-form-item
- v-if="timeTypeValue === 'year'"
- label="年份:"
- >
- <el-date-picker
- v-model="projectCostBody.yearTime"
- type="year"
- placeholder="请选择年份"
- format="YYYY"
- value-format="YYYY"
- clearable
- @clear="projectCostBody.yearTime = ''"
- />
- </el-form-item>
- <el-form-item label="费用类型:" size="large">
- <el-select
- v-model="projectCostBody.genre"
- placeholder="请选择费用类型"
- clearable
- @clear="projectCostBody.genre = 0"
- >
- <el-option
- v-for="item in costTypeList"
- :key="item.ID"
- :label="item.name"
- :value="item.ID"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="人员:" size="large">
- <el-select
- placeholder="请选择人员"
- v-model="projectCostBody.reimburser"
- clearable
- @clear="projectCostBody.reimburser = 0"
- >
- <el-option
- v-for="item in userList"
- :key="item.ID"
- :label="item.nickName"
- :value="item.ID"
- />
- </el-select>
- </el-form-item>
- </el-form>
- </van-col>
- </van-row>
- <van-row style="margin-top: 3vh">
- <el-col
- :span="22"
- :offset="1"
- style="display: flex;justify-content: end">
- <el-button
- style="width: 25vw"
- @click="queryProjectCost"
- type="primary"
- size="large"
- >
- 确认
- </el-button>
- </el-col>
- </van-row>
- </van-popup>
- <van-popup
- v-model:show="detailShow"
- position="bottom"
- style="height: 50vh;"
- >
- <van-cell-group style="font-size: 16px">
- <van-cell size="large" title="部门:">
- <template #value>
- <van-text-ellipsis :content="detailInfo.department.name"/>
- </template>
- </van-cell>
- <van-cell size="large" title="支入金额:">
- <template #value>
- <van-text-ellipsis :content="detailInfo.depositAmount"/>
- </template>
- </van-cell>
- <van-cell size="large" title="支出金额:">
- <template #value>
- <van-text-ellipsis :content="detailInfo.expenditureAmount"/>
- </template>
- </van-cell>
- <van-cell size="large" title="余额:">
- <template #value>
- <van-text-ellipsis :content="detailInfo.thenBalance"/>
- </template>
- </van-cell>
- </van-cell-group>
- </van-popup>
- </template>
- <script setup>
- import { getProjectCostType, getAllProject, getProjectCost } from '@/api/project.js'
- import { getAllUsers } from "@/api/user.js"
- defineOptions({
- name: 'projectCost',
- })
- onMounted(() => {
- queryProjectCostType()
- queryAllUsers()
- queryAllProject()
- queryProjectCost()
- })
- // 条件显示
- const projectCostBody = reactive({
- pageInfo: {
- page: 1,
- pageSize: 8
- },
- reimburser: 0,
- projectCode: "",
- genre: 0,
- dayTime: "",
- monthTime: "",
- yearTime: ""
- })
- // 费用类型
- const costTypeList = reactive([])
- const queryProjectCostType = () => {
- getProjectCostType().then(res => {
- if (res.code === 0) {
- costTypeList.push(...res.data)
- }
- })
- }
- // 项目
- const projectList = reactive([])
- const queryAllProject = () => {
- getAllProject().then(res => {
- if (res.code === 0) {
- const list = res.data
- projectList.push(...list)
- }
- })
- }
- // 人员
- const userList = reactive([])
- const queryAllUsers = () => {
- getAllUsers().then(res => {
- if (res.code === 0) {
- userList.push(...res.data)
- }
- })
- }
- const dateScreenShow = ref(false)
- const openScreen = () => {}
- const dateType = ref([])
- const currentDate = ref([])
- const dateTypeColumns = [
- { id:0, text: '按日期选择', value: "day" },
- { id:1, text: '按月份选择', value: "month" },
- { id:2, text: '按年份选择', value: "year" }
- ]
- const changeDateType = (val) => {
- const index = val.selectedIndexes[0]
- const obj = {
- 0: [],
- 1: ['year'],
- 2: ['year','month'],
- 3: ['year','month','day'],
- }
- dateType.value = obj[index]
- }
- // 查询项目费用
- const timeTypeValue = ref('day')
- const projectCostList = reactive([])
- const queryProjectCost = () => {
- getProjectCost(projectCostBody).then(res => {
- if (res.code === 0) {
- dateScreenShow.value = false
- projectCostList.push(...res.data.list)
- console.log(projectCostList)
- }
- })
- }
- const detailShow = ref(false)
- const detailInfo = reactive({})
- const openCostDetail = (item) => {
- const { depositAmount,expenditureAmount,thenBalance } = item
- item.depositAmount = depositAmount.toString()
- item.expenditureAmount = expenditureAmount.toString()
- item.thenBalance = thenBalance.toString()
- detailShow.value = true
- Object.assign(detailInfo,item)
- }
- </script>
- <style scoped lang="less">
- .costCell{
- height: 64px;
- }
- .checkCell{
- height: 45px;
- }
- .closeIcon{
- font-size: 24px;
- line-height: inherit;
- }
- .cellContent{
- margin-right: 10px;
- line-height: inherit;
- }
- </style>
|