Browse Source

收入分析

curry 8 months ago
parent
commit
1fc6155058

+ 1 - 1
web/.env.development

@@ -4,7 +4,7 @@ VITE_CLI_PORT = 8080
 VITE_SERVER_PORT = 8220
 VITE_BASE_API = /api
 VITE_FILE_API = /api
-VITE_BASE_PATH = http://127.0.0.1
+VITE_BASE_PATH = http://106.52.134.22
 VITE_POSITION = close
 VITE_EDITOR = webstorm
 

+ 1 - 1
web/src/api/hour.js

@@ -3,7 +3,7 @@ import service from '@/utils/request'
 // 查询工时
 export const queryHour = (code) => {
   return service({
-    url: '/project/queryCollection',
+    url: '/project/queryWorkingHours',
     method: 'get',
     params: {
       code: code

+ 6 - 2
web/src/pinia/collection/Collection.js

@@ -1,6 +1,7 @@
 import { defineStore } from 'pinia'
 import { reactive } from 'vue'
 import { createCollection, deleteCollection, queryCollection, updateCollection } from '@/api/collection'
+import { formatDate } from '@/utils/formatDate'
 
 export const collectionOperate = defineStore('payment', () => {
   // 定义数据
@@ -9,9 +10,12 @@ export const collectionOperate = defineStore('payment', () => {
   const getPaymentList = (code) => {
     queryCollection(code).then(res => {
       if (res.code === 0) {
+        const data = res.data
+        data.forEach(item => {
+          item.collectionTime = formatDate(item.collectionTime)
+        })
         paymentList.length = 0
-        paymentList.push(...res.data)
-        console.log(paymentList)
+        paymentList.push(...data)
       }
     })
   }

+ 0 - 1
web/src/pinia/hour/Hour.js

@@ -11,7 +11,6 @@ export const hourOperate = defineStore('time', () => {
       if (res.code === 0) {
         timeList.length = 0
         timeList.push(...res.data)
-        console.log(timeList)
       }
     })
   }

+ 14 - 0
web/src/utils/formatDate.js

@@ -0,0 +1,14 @@
+export const formatDate = (dateString, locale = 'en-US', timezone = 'Asia/Shanghai') => {
+  // 使用 Date 构造函数解析日期字符串
+  const date = new Date(dateString)
+
+  // 检查日期是否有效
+  if (isNaN(date.getTime())) {
+    throw new Error('Invalid date string')
+  }
+
+  // 使用 Date 对象的年份、月份和日期来构建新的日期字符串
+  // 注意:JavaScript 中的月份是从 0 开始的,所以我们需要加 1
+
+  return `${date.getFullYear()}-${('0' + (date.getMonth() + 1)).slice(-2)}-${('0' + date.getDate()).slice(-2)}`
+}

+ 25 - 4
web/src/view/finance/components/hour.vue

@@ -1,12 +1,33 @@
 <template>
-
+  <div>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item
+              label="人员名称:"
+          >
+            <el-input
+                v-model="condition.name"
+                placeholder="请输入人员名称"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-table>
+          <el-table-column/>
+        </el-table>
+      </el-row>
+  </div>
 </template>
 
-<script>
+<script setup>
+import { reactive } from 'vue'
 defineOptions({
-  name: 'hour'
+  name: 'Hour'
+})
+const condition = reactive({
+  name: ''
 })
-
 </script>
 
 <style scoped>

+ 46 - 3
web/src/view/finance/components/payment.vue

@@ -1,11 +1,54 @@
 <template>
-
+  <div>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item
+          label="收款日期:"
+        >
+          <el-date-picker
+            v-model="paymentTime"
+            type="date"
+            placeholder="请选择收款日期"
+            format="YYYY-MM-DD"
+            value-format="YYYY-MM-DD"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="3">
+        <el-button
+          type="primary"
+          :icon="Search"
+        >查询</el-button>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="12">
+        <el-table v-model="pay.paymentList">
+          <el-table-column
+            label="收款时间"
+            prop="collectionTime"
+          />
+          <el-table-column
+            label="收款金额"
+            prop="price"
+          />
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
 </template>
 
-<script>
+<script setup>
+import { ref } from 'vue'
+import { Search } from '@element-plus/icons-vue'
+import { collectionOperate } from '@/pinia/collection/Collection'
 defineOptions({
-  name: 'payment'
+  name: 'Payment'
 })
+const paymentTime = ref('')
+const pay = collectionOperate()
+console.log(pay.paymentList)
+
 </script>
 
 <style scoped>

+ 13 - 4
web/src/view/finance/financeAnalysis/financeAnalysis.vue

@@ -157,9 +157,9 @@
     </el-row>
     <el-row
       class="bg-white mt-5"
-      style="height: 540px"
+      style="height: 510px"
     >
-      <el-col :span="20" class="ml-10 mt-5">
+      <el-col :span="20" class="ml-10">
         <el-tabs
             v-model="listSort"
             class="demo-tabs"
@@ -168,7 +168,9 @@
           <el-tab-pane
               label="实施工时"
               :name="1"
-          >User</el-tab-pane>
+          >
+            <Hour/>
+          </el-tab-pane>
           <el-tab-pane
               label="费用报销"
               :name="2"
@@ -176,7 +178,9 @@
           <el-tab-pane
               label="项目收款"
               :name="3"
-          >Role</el-tab-pane>
+          >
+            <payment/>
+          </el-tab-pane>
         </el-tabs>
       </el-col>
     </el-row>
@@ -254,6 +258,9 @@ import { getProjectList, getProjectMessage } from '@/api/project'
 import { collectionOperate } from '@/pinia/collection/Collection'
 import iconCollection from '@/assets/Collection.png'
 import iconAmount from '@/assets/amount.png'
+import Hour from '../components/hour.vue'
+import Payment from '../components/payment.vue'
+import { hourOperate } from '@/pinia/hour/Hour'
 defineOptions({
   name: 'FinanceAnalysis'
 })
@@ -273,6 +280,7 @@ const listData = reactive([])
 const projectTotal = ref(0)
 const projectMessage = reactive({})
 const listSort = ref(1)
+const hour = hourOperate()
 
 // 计算属性
 const buttonType = computed(() => (state) => {
@@ -308,6 +316,7 @@ const projectList = (condition) => {
       projectTotal.value = res.data.total
       listData.push(...list)
       payment.getPaymentList(list[0].code)
+      hour.getTimeList(list[0].code)
       getProjectMessage(list[0].code).then(res => {
         if (res.code === 0) {
           Object.assign(projectMessage, res.data)