projectCost.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <van-row style="margin-top: 20px" @click="dateScreenShow = true">
  3. <van-col :span="24">
  4. <van-cell-group>
  5. <van-cell title="筛选条件" is-link size="large" class="checkCell">
  6. <template #value>
  7. <van-text-ellipsis content="内容" class="cellContent"/>
  8. </template>
  9. <template #right-icon>
  10. <van-icon
  11. class="closeIcon"
  12. name="close"
  13. />
  14. </template>
  15. </van-cell>
  16. </van-cell-group>
  17. </van-col>
  18. </van-row>
  19. <van-cell-group>
  20. <van-cell
  21. v-for="item in projectCostList"
  22. :key="item.ID"
  23. :title="item.user.nickName"
  24. :label="item.feeTime"
  25. is-link
  26. class="costCell"
  27. @click="openCostDetail(item)"
  28. >
  29. <template #value>
  30. <van-text-ellipsis :content="item.projectFeeGenre.name"/>
  31. </template>
  32. </van-cell>
  33. </van-cell-group>
  34. <van-popup
  35. v-model:show="dateScreenShow"
  36. position="bottom"
  37. style="height: 70vh"
  38. closeable
  39. close-icon-position="top-right"
  40. >
  41. <van-row style="margin-top: 8vh">
  42. <van-col :span="22" :offset="1">
  43. <el-form label-width="100" label-position="left" size="large">
  44. <el-form-item label="项目:" size="large">
  45. <el-select
  46. placeholder="请选择项目"
  47. v-model="projectCostBody.projectCode"
  48. clearable
  49. @clear="projectCostBody.projectCode = ''"
  50. >
  51. <el-option
  52. v-for="item in projectList"
  53. :key="item.ID"
  54. :label="item.name"
  55. :value="item.code"
  56. />
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="选择器类型:" size="large">
  60. <el-select placeholder="请选择日期选择器类型" v-model="timeTypeValue">
  61. <el-option
  62. v-for="item in dateTypeColumns"
  63. :key="item.id"
  64. :label="item.text"
  65. :value="item.value"
  66. />
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item
  70. v-if="timeTypeValue === 'day'"
  71. label="日期:"
  72. size="large">
  73. <el-date-picker
  74. v-model="projectCostBody.dayTime"
  75. type="date"
  76. placeholder="请选择日期"
  77. format="YYYY-MM-DD"
  78. value-format="YYYY-MM-DD"
  79. clearable
  80. @clear="projectCostBody.dayTime = ''"
  81. />
  82. </el-form-item>
  83. <el-form-item
  84. v-if="timeTypeValue === 'month'"
  85. label="月份:"
  86. >
  87. <el-date-picker
  88. v-model="projectCostBody.monthTime"
  89. type="month"
  90. placeholder="请选择月份"
  91. format="YYYY-MM"
  92. value-format="YYYY-MM"
  93. clearable
  94. @clear="projectCostBody.monthTime = ''"
  95. />
  96. </el-form-item>
  97. <el-form-item
  98. v-if="timeTypeValue === 'year'"
  99. label="年份:"
  100. >
  101. <el-date-picker
  102. v-model="projectCostBody.yearTime"
  103. type="year"
  104. placeholder="请选择年份"
  105. format="YYYY"
  106. value-format="YYYY"
  107. clearable
  108. @clear="projectCostBody.yearTime = ''"
  109. />
  110. </el-form-item>
  111. <el-form-item label="费用类型:" size="large">
  112. <el-select
  113. v-model="projectCostBody.genre"
  114. placeholder="请选择费用类型"
  115. clearable
  116. @clear="projectCostBody.genre = 0"
  117. >
  118. <el-option
  119. v-for="item in costTypeList"
  120. :key="item.ID"
  121. :label="item.name"
  122. :value="item.ID"
  123. />
  124. </el-select>
  125. </el-form-item>
  126. <el-form-item label="人员:" size="large">
  127. <el-select
  128. placeholder="请选择人员"
  129. v-model="projectCostBody.reimburser"
  130. clearable
  131. @clear="projectCostBody.reimburser = 0"
  132. >
  133. <el-option
  134. v-for="item in userList"
  135. :key="item.ID"
  136. :label="item.nickName"
  137. :value="item.ID"
  138. />
  139. </el-select>
  140. </el-form-item>
  141. </el-form>
  142. </van-col>
  143. </van-row>
  144. <van-row style="margin-top: 3vh">
  145. <el-col
  146. :span="22"
  147. :offset="1"
  148. style="display: flex;justify-content: end">
  149. <el-button
  150. style="width: 25vw"
  151. @click="queryProjectCost"
  152. type="primary"
  153. size="large"
  154. >
  155. 确认
  156. </el-button>
  157. </el-col>
  158. </van-row>
  159. </van-popup>
  160. <van-popup
  161. v-model:show="detailShow"
  162. position="bottom"
  163. style="height: 50vh;"
  164. >
  165. <van-cell-group style="font-size: 16px">
  166. <van-cell size="large" title="部门:">
  167. <template #value>
  168. <van-text-ellipsis :content="detailInfo.department.name"/>
  169. </template>
  170. </van-cell>
  171. <van-cell size="large" title="支入金额:">
  172. <template #value>
  173. <van-text-ellipsis :content="detailInfo.depositAmount"/>
  174. </template>
  175. </van-cell>
  176. <van-cell size="large" title="支出金额:">
  177. <template #value>
  178. <van-text-ellipsis :content="detailInfo.expenditureAmount"/>
  179. </template>
  180. </van-cell>
  181. <van-cell size="large" title="余额:">
  182. <template #value>
  183. <van-text-ellipsis :content="detailInfo.thenBalance"/>
  184. </template>
  185. </van-cell>
  186. </van-cell-group>
  187. </van-popup>
  188. </template>
  189. <script setup>
  190. import { getProjectCostType, getAllProject, getProjectCost } from '@/api/project.js'
  191. import { getAllUsers } from "@/api/user.js"
  192. defineOptions({
  193. name: 'projectCost',
  194. })
  195. onMounted(() => {
  196. queryProjectCostType()
  197. queryAllUsers()
  198. queryAllProject()
  199. queryProjectCost()
  200. })
  201. // 条件显示
  202. const projectCostBody = reactive({
  203. pageInfo: {
  204. page: 1,
  205. pageSize: 8
  206. },
  207. reimburser: 0,
  208. projectCode: "",
  209. genre: 0,
  210. dayTime: "",
  211. monthTime: "",
  212. yearTime: ""
  213. })
  214. // 费用类型
  215. const costTypeList = reactive([])
  216. const queryProjectCostType = () => {
  217. getProjectCostType().then(res => {
  218. if (res.code === 0) {
  219. costTypeList.push(...res.data)
  220. }
  221. })
  222. }
  223. // 项目
  224. const projectList = reactive([])
  225. const queryAllProject = () => {
  226. getAllProject().then(res => {
  227. if (res.code === 0) {
  228. const list = res.data
  229. projectList.push(...list)
  230. }
  231. })
  232. }
  233. // 人员
  234. const userList = reactive([])
  235. const queryAllUsers = () => {
  236. getAllUsers().then(res => {
  237. if (res.code === 0) {
  238. userList.push(...res.data)
  239. }
  240. })
  241. }
  242. const dateScreenShow = ref(false)
  243. const openScreen = () => {}
  244. const dateType = ref([])
  245. const currentDate = ref([])
  246. const dateTypeColumns = [
  247. { id:0, text: '按日期选择', value: "day" },
  248. { id:1, text: '按月份选择', value: "month" },
  249. { id:2, text: '按年份选择', value: "year" }
  250. ]
  251. const changeDateType = (val) => {
  252. const index = val.selectedIndexes[0]
  253. const obj = {
  254. 0: [],
  255. 1: ['year'],
  256. 2: ['year','month'],
  257. 3: ['year','month','day'],
  258. }
  259. dateType.value = obj[index]
  260. }
  261. // 查询项目费用
  262. const timeTypeValue = ref('day')
  263. const projectCostList = reactive([])
  264. const queryProjectCost = () => {
  265. getProjectCost(projectCostBody).then(res => {
  266. if (res.code === 0) {
  267. dateScreenShow.value = false
  268. projectCostList.push(...res.data.list)
  269. console.log(projectCostList)
  270. }
  271. })
  272. }
  273. const detailShow = ref(false)
  274. const detailInfo = reactive({})
  275. const openCostDetail = (item) => {
  276. const { depositAmount,expenditureAmount,thenBalance } = item
  277. item.depositAmount = depositAmount.toString()
  278. item.expenditureAmount = expenditureAmount.toString()
  279. item.thenBalance = thenBalance.toString()
  280. detailShow.value = true
  281. Object.assign(detailInfo,item)
  282. }
  283. </script>
  284. <style scoped lang="less">
  285. .costCell{
  286. height: 64px;
  287. }
  288. .checkCell{
  289. height: 45px;
  290. }
  291. .closeIcon{
  292. font-size: 24px;
  293. line-height: inherit;
  294. }
  295. .cellContent{
  296. margin-right: 10px;
  297. line-height: inherit;
  298. }
  299. </style>