Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/dev' into dev

xuwenhao 1 gadu atpakaļ
vecāks
revīzija
bd1a787b8d

+ 1 - 1
server/go.mod

@@ -25,6 +25,7 @@ require (
 	github.com/redis/go-redis/v9 v9.0.5
 	github.com/robfig/cron/v3 v3.0.1
 	github.com/shirou/gopsutil/v3 v3.23.6
+	github.com/shopspring/decimal v1.4.0
 	github.com/songzhibin97/gkit v1.2.11
 	github.com/spf13/viper v1.16.0
 	github.com/stretchr/testify v1.8.4
@@ -102,7 +103,6 @@ require (
 	github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
 	github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
 	github.com/shoenig/go-m1cpu v0.1.6 // indirect
-	github.com/shopspring/decimal v1.4.0 // indirect
 	github.com/spf13/afero v1.9.5 // indirect
 	github.com/spf13/cast v1.5.1 // indirect
 	github.com/spf13/jwalterweatherman v1.1.0 // indirect

+ 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

BIN
web/src/assets/Collection.png


BIN
web/src/assets/amount.png


BIN
web/src/assets/hour.png


+ 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)}`
+}

+ 35 - 0
web/src/view/finance/components/hour.vue

@@ -0,0 +1,35 @@
+<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 setup>
+import { reactive } from 'vue'
+defineOptions({
+  name: 'Hour'
+})
+const condition = reactive({
+  name: ''
+})
+</script>
+
+<style scoped>
+
+</style>

+ 56 - 0
web/src/view/finance/components/payment.vue

@@ -0,0 +1,56 @@
+<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 setup>
+import { ref } from 'vue'
+import { Search } from '@element-plus/icons-vue'
+import { collectionOperate } from '@/pinia/collection/Collection'
+defineOptions({
+  name: 'Payment'
+})
+const paymentTime = ref('')
+const pay = collectionOperate()
+console.log(pay.paymentList)
+
+</script>
+
+<style scoped>
+
+</style>

+ 13 - 0
web/src/view/finance/components/reimburse.vue

@@ -0,0 +1,13 @@
+<template>
+
+</template>
+
+<script>
+defineOptions({
+  name: 'reimburse'
+})
+</script>
+
+<style scoped>
+
+</style>

+ 125 - 21
web/src/view/finance/financeAnalysis/financeAnalysis.vue

@@ -2,7 +2,7 @@
   <div>
     <el-row
       class="bg-white"
-      style="height: 90px"
+      style="height: 80px"
       align="middle"
     >
       <el-col
@@ -11,9 +11,9 @@
       >
         <span class="analysisTitle">收支分析</span>
       </el-col>
-      <el-col :span="14">
+      <el-col :span="13">
         <el-row>
-          <el-col :span="8">
+          <el-col :span="10">
             <el-row
               justify="center"
               align="middle"
@@ -34,7 +34,7 @@
               <el-text>项目名称</el-text>
             </el-row>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="7">
             <el-row
               justify="center"
               align="middle"
@@ -55,23 +55,23 @@
               <el-text>项目金额</el-text>
             </el-row>
           </el-col>
-          <el-col :span="4">
+          <el-col :span="7">
             <el-row
-                justify="center"
-                align="middle"
+              justify="center"
+              align="middle"
             >
               <el-text
-                  style="font-size: 20px;color: #409eff;"
-                  tag="b"
-                  :line-clamp="1"
+                style="font-size: 20px;color: #409eff;"
+                tag="b"
+                :line-clamp="1"
               >
                 {{ projectMessage.name }}
               </el-text>
             </el-row>
             <el-row
-                justify="center"
-                align="middle"
-                style="margin-top: 8px"
+              justify="center"
+              align="middle"
+              style="margin-top: 8px"
             >
               <el-text>项目收款</el-text>
             </el-row>
@@ -79,13 +79,15 @@
         </el-row>
       </el-col>
       <el-col
-        :span="2"
+        :span="3"
         :offset="4"
+        class="flex justify-center"
       >
         <el-button
           text
           :icon="Menu"
           size="large"
+          style="font-size: 18px"
           @click="listShow = true"
         >
           项目列表
@@ -93,13 +95,95 @@
       </el-col>
     </el-row>
     <el-row
-      class="bg-white mt-5"
+      class="mt-5"
       style="height: 150px"
-    />
+      justify="space-between"
+    >
+      <el-col
+        :span="4"
+        class="bg-white"
+      >
+        <el-row
+          style="height: 100px"
+          align="middle"
+        >
+          <el-col
+            :span="13"
+            :offset="1"
+          >
+            <el-text>项目收款</el-text>
+          </el-col>
+          <el-col
+            :span="9"
+            class="flex justify-center"
+          >
+            <el-image
+              :src="iconCollection"
+              class="iconStyle"
+            />
+          </el-col>
+        </el-row>
+        <el-row
+          style="height: 50px"
+          align="middle"
+        >
+          <el-col
+            :span="4"
+            :offset="1"
+          >
+            <el-image
+              :src="iconAmount"
+              class="countIcon"
+            />
+          </el-col>
+        </el-row>
+      </el-col>
+      <el-col
+        :span="4"
+        class="bg-white"
+      />
+      <el-col
+        :span="4"
+        class="bg-white"
+      />
+      <el-col
+        :span="4"
+        class="bg-white"
+      />
+      <el-col
+        :span="4"
+        class="bg-white"
+      />
+    </el-row>
     <el-row
       class="bg-white mt-5"
-      style="height: 540px"
-    />
+      style="height: 510px"
+    >
+      <el-col :span="20" class="ml-10">
+        <el-tabs
+            v-model="listSort"
+            class="demo-tabs"
+            @tab-click="changeSort"
+        >
+          <el-tab-pane
+              label="实施工时"
+              :name="1"
+          >
+            <Hour/>
+          </el-tab-pane>
+          <el-tab-pane
+              label="费用报销"
+              :name="2"
+          >Config</el-tab-pane>
+          <el-tab-pane
+              label="项目收款"
+              :name="3"
+          >
+            <payment/>
+          </el-tab-pane>
+        </el-tabs>
+      </el-col>
+    </el-row>
     <el-drawer
       v-model="listShow"
       direction="ltr"
@@ -172,6 +256,11 @@ import { Menu, Search } from '@element-plus/icons-vue'
 import { ref, onMounted, reactive, computed } from 'vue'
 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'
 })
@@ -190,6 +279,8 @@ const condition = reactive({
 const listData = reactive([])
 const projectTotal = ref(0)
 const projectMessage = reactive({})
+const listSort = ref(1)
+const hour = hourOperate()
 
 // 计算属性
 const buttonType = computed(() => (state) => {
@@ -204,12 +295,13 @@ const buttonType = computed(() => (state) => {
 })
 
 const projectAmount = computed(() => {
-  // const price = ref(parseInt(projectMessage.price))
-  const price = ref(482000)
+  const price = ref(parseInt(projectMessage.price))
+  // const price = ref(4892703)
   if (price.value < 10000) {
     return price.value + '元'
   } else {
-    return (price.value / 10000).toFixed(4) + '万元'
+    const tenThousand = (price.value / 10000).toFixed(4)
+    return parseFloat(tenThousand) + '万元'
   }
 })
 // 方法
@@ -224,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)
@@ -244,7 +337,10 @@ const changePage = (page) => {
   projectList(search)
 }
 
+const changeSort = () => {}
+
 const incomeExpenses = (code) => {}
+
 </script>
 
 <style lang="scss" scoped>
@@ -252,4 +348,12 @@ const incomeExpenses = (code) => {}
     font-size: 20px;
     font-weight: 520;
   }
+  .iconStyle{
+    width: 70px;
+    height: 80px;
+  }
+  .countIcon{
+    width: 28px;
+    height: 28px;
+  }
 </style>