financeAnalysis.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <div>
  3. <el-row
  4. class="bg-white"
  5. style="height: 80px"
  6. align="middle"
  7. >
  8. <el-col
  9. :span="4"
  10. class="flex justify-center"
  11. >
  12. <span class="analysisTitle">收支分析</span>
  13. </el-col>
  14. <el-col :span="13">
  15. <el-row>
  16. <el-col :span="10">
  17. <el-row
  18. justify="center"
  19. align="middle"
  20. >
  21. <el-text
  22. style="font-size: 20px;color: #409eff;"
  23. tag="b"
  24. :line-clamp="1"
  25. >
  26. {{ projectMessage.name }}
  27. </el-text>
  28. </el-row>
  29. <el-row
  30. justify="center"
  31. align="middle"
  32. style="margin-top: 8px"
  33. >
  34. <el-text>项目名称</el-text>
  35. </el-row>
  36. </el-col>
  37. <el-col :span="7">
  38. <el-row
  39. justify="center"
  40. align="middle"
  41. >
  42. <el-text
  43. style="font-size: 20px;color: #409eff;"
  44. tag="b"
  45. :line-clamp="1"
  46. >
  47. {{ projectAmount }}
  48. </el-text>
  49. </el-row>
  50. <el-row
  51. justify="center"
  52. align="middle"
  53. style="margin-top: 8px"
  54. >
  55. <el-text>项目金额</el-text>
  56. </el-row>
  57. </el-col>
  58. <el-col :span="7">
  59. <el-row
  60. justify="center"
  61. align="middle"
  62. >
  63. <el-text
  64. style="font-size: 20px;color: #409eff;"
  65. tag="b"
  66. :line-clamp="1"
  67. >
  68. {{ projectMessage.name }}
  69. </el-text>
  70. </el-row>
  71. <el-row
  72. justify="center"
  73. align="middle"
  74. style="margin-top: 8px"
  75. >
  76. <el-text>项目收款</el-text>
  77. </el-row>
  78. </el-col>
  79. </el-row>
  80. </el-col>
  81. <el-col
  82. :span="3"
  83. :offset="4"
  84. class="flex justify-center"
  85. >
  86. <el-button
  87. text
  88. :icon="Menu"
  89. size="large"
  90. style="font-size: 18px"
  91. @click="listShow = true"
  92. >
  93. 项目列表
  94. </el-button>
  95. </el-col>
  96. </el-row>
  97. <el-row
  98. class="mt-5"
  99. style="height: 150px"
  100. justify="space-between"
  101. >
  102. <el-col
  103. :span="4"
  104. class="bg-white"
  105. >
  106. <el-row
  107. style="height: 100px"
  108. align="middle"
  109. >
  110. <el-col
  111. :span="13"
  112. :offset="1"
  113. >
  114. <el-text>项目收款</el-text>
  115. </el-col>
  116. <el-col
  117. :span="9"
  118. class="flex justify-center"
  119. >
  120. <el-image
  121. :src="iconCollection"
  122. class="iconStyle"
  123. />
  124. </el-col>
  125. </el-row>
  126. <el-row
  127. style="height: 50px"
  128. align="middle"
  129. >
  130. <el-col
  131. :span="4"
  132. :offset="1"
  133. >
  134. <el-image
  135. :src="iconAmount"
  136. class="countIcon"
  137. />
  138. </el-col>
  139. </el-row>
  140. </el-col>
  141. <el-col
  142. :span="4"
  143. class="bg-white"
  144. />
  145. <el-col
  146. :span="4"
  147. class="bg-white"
  148. />
  149. <el-col
  150. :span="4"
  151. class="bg-white"
  152. />
  153. <el-col
  154. :span="4"
  155. class="bg-white"
  156. />
  157. </el-row>
  158. <el-row
  159. class="bg-white mt-5"
  160. style="height: 540px"
  161. >
  162. <el-col
  163. :span="20"
  164. class="ml-10"
  165. >
  166. <el-tabs
  167. v-model="listSort"
  168. class="demo-tabs"
  169. @tab-click="changeSort"
  170. >
  171. <el-tab-pane
  172. label="实施工时"
  173. :name="1"
  174. >
  175. <Hour />
  176. </el-tab-pane>
  177. <el-tab-pane
  178. label="费用报销"
  179. :name="2"
  180. >Config</el-tab-pane>
  181. <el-tab-pane
  182. label="项目收款"
  183. :name="3"
  184. >
  185. <payment />
  186. </el-tab-pane>
  187. </el-tabs>
  188. </el-col>
  189. </el-row>
  190. <el-drawer
  191. v-model="listShow"
  192. direction="ltr"
  193. title="项目列表"
  194. size="25%"
  195. >
  196. <el-form @submit.prevent>
  197. <el-row>
  198. <el-col :span="24">
  199. <el-form-item>
  200. <el-input
  201. v-model="condition.name"
  202. :suffix-icon="Search"
  203. placeholder="请输入项目名称"
  204. size="large"
  205. clearable
  206. @keyup.enter="nameSearch"
  207. />
  208. </el-form-item>
  209. </el-col>
  210. </el-row>
  211. <el-row
  212. v-for="item in listData"
  213. :key="item.ID"
  214. style="height: 80px"
  215. align="middle"
  216. >
  217. <el-col :span="17">
  218. <el-row style="height: 45px">
  219. <el-text
  220. size="large"
  221. :line-clamp="1"
  222. tag="b"
  223. >{{ item.name }}</el-text>
  224. </el-row>
  225. <el-row style="height: 35px">
  226. <el-text :line-clamp="1">
  227. 负责人:{{ item.principal }}
  228. </el-text>
  229. </el-row>
  230. </el-col>
  231. <el-col
  232. :span="7"
  233. class="flex justify-center"
  234. >
  235. <el-button
  236. :type="buttonType(item.state)"
  237. round
  238. size="large"
  239. @click="incomeExpenses(item.code)"
  240. >收支信息</el-button>
  241. </el-col>
  242. </el-row>
  243. </el-form>
  244. <el-pagination
  245. v-show="projectTotal > 8"
  246. v-model:current-page="condition.pageInfo.page"
  247. background
  248. layout="prev, pager, next"
  249. :total="projectTotal"
  250. :page-size="8"
  251. @change="changePage"
  252. />
  253. </el-drawer>
  254. </div>
  255. </template>
  256. <script setup>
  257. import { Menu, Search } from '@element-plus/icons-vue'
  258. import { ref, onMounted, reactive, computed } from 'vue'
  259. import { getProjectList, getProjectMessage, queryProjectExpense } from '@/api/project'
  260. import { collectionOperate } from '@/pinia/collection/Collection'
  261. import iconCollection from '@/assets/Collection.png'
  262. import iconAmount from '@/assets/amount.png'
  263. import Hour from '../components/hour.vue'
  264. import Payment from '../components/payment.vue'
  265. import { hourOperate } from '@/pinia/hour/Hour'
  266. defineOptions({
  267. name: 'FinanceAnalysis'
  268. })
  269. // 数据
  270. const payment = collectionOperate()
  271. const listShow = ref(false)
  272. const condition = reactive({
  273. pageInfo: {
  274. page: 1,
  275. pageSize: 8
  276. },
  277. name: '',
  278. time: '',
  279. state: 0
  280. })
  281. const listData = reactive([])
  282. const projectTotal = ref(0)
  283. const projectMessage = reactive({})
  284. const listSort = ref(1)
  285. const hour = hourOperate()
  286. // 计算属性
  287. const buttonType = computed(() => (state) => {
  288. const obj = {
  289. 1: 'info',
  290. 2: 'warning',
  291. 3: 'primary',
  292. 4: 'success',
  293. 5: 'danger',
  294. }
  295. return obj[state]
  296. })
  297. const projectAmount = computed(() => {
  298. const price = ref(parseInt(projectMessage.price))
  299. // const price = ref(4892703)
  300. if (price.value < 10000) {
  301. return price.value + '元'
  302. } else {
  303. const tenThousand = (price.value / 10000).toFixed(4)
  304. return parseFloat(tenThousand) + '万元'
  305. }
  306. })
  307. // 方法
  308. onMounted(() => {
  309. projectList(condition)
  310. })
  311. const projectList = (condition) => {
  312. listData.length = 0
  313. getProjectList(condition).then(res => {
  314. if (res.code === 0) {
  315. const list = res.data.list
  316. projectTotal.value = res.data.total
  317. listData.push(...list)
  318. hour.getTimeList(list[0].code)
  319. payment.changePaymentCode(list[0].code)
  320. queryProjectExpense(list[0].code).then(res => {
  321. if (res.code === 0) {
  322. payment.changePaymentList(res.data.collection)
  323. }
  324. })
  325. getProjectMessage(list[0].code).then(res => {
  326. if (res.code === 0) {
  327. Object.assign(projectMessage, res.data)
  328. }
  329. })
  330. }
  331. })
  332. }
  333. const nameSearch = () => {
  334. condition.pageInfo.page = 1
  335. console.log(condition)
  336. projectList(condition)
  337. }
  338. const changePage = (page) => {
  339. const search = condition
  340. search.pageInfo.page = page
  341. console.log(search)
  342. projectList(search)
  343. }
  344. const changeSort = () => {}
  345. const incomeExpenses = (code) => {}
  346. </script>
  347. <style lang="scss" scoped>
  348. .analysisTitle{
  349. font-size: 20px;
  350. font-weight: 520;
  351. }
  352. .iconStyle{
  353. width: 70px;
  354. height: 80px;
  355. }
  356. .countIcon{
  357. width: 28px;
  358. height: 28px;
  359. }
  360. </style>