xuwenhao 8 months ago
parent
commit
faaf8898c0

+ 66 - 56
web/src/view/dashboard/dashboardCharts/echartsLine.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="dashboard-line-box">
     <div class="dashboard-line-title">
-      访问趋势
+      公司费用
     </div>
     <div
       ref="echart"
@@ -13,31 +13,25 @@
 import * as echarts from 'echarts'
 import { nextTick, onMounted, onUnmounted, ref } from 'vue'
 import { useWindowResize } from '@/hooks/use-windows-resize'
-var dataAxis = []
-for (var i = 1; i < 13; i++) {
-  dataAxis.push(`${i}月`)
-}
-var data = [
-  220,
-  182,
-  191,
-  234,
-  290,
-  330,
-  310,
-  123,
-  442,
-  321,
-  90,
-  149,
-]
-var yMax = 500
-var dataShadow = []
+import { querySurplus } from '@/api/cost'
 
-for (let i = 0; i < data.length; i++) {
-  dataShadow.push(yMax)
+const queryData = async() => {
+  await querySurplus().then(res => {
+    console.log(res.data)
+    for (let i = 0; i < res.data.length; i++) {
+      dataAxis.push(res.data[i].FeeTime)
+      expenditureData.push(res.data[i].ExpenditureAmountSum)
+      depositData.push(res.data[i].DepositAmountSum)
+      surplusData.push(res.data[i].Surplus)
+    }
+  })
 }
 
+var dataAxis = []
+var expenditureData = []
+var depositData = []
+var surplusData = []
+
 let chart = null
 const echart = ref(null)
 
@@ -57,54 +51,69 @@ const initChart = () => {
 }
 const setOptions = () => {
   chart.setOption({
+    legend: {
+      data: ['支出', '支入', '盈余']
+    },
     grid: {
-      left: '40',
-      right: '20',
-      top: '40',
-      bottom: '20',
+      left: '3%',
+      right: '4%',
+      bottom: '3%',
+      containLabel: true
     },
     xAxis: {
+      type: 'category',
+      boundaryGap: false,
       data: dataAxis,
-      axisTick: {
-        show: false,
-      },
-      axisLine: {
-        show: false,
-      },
-      z: 10,
     },
     yAxis: {
-      axisLine: {
-        show: false,
-      },
-      axisTick: {
-        show: false,
-      },
-      axisLabel: {
-        textStyle: {
-          color: '#999',
-        },
+      type: 'value'
+    },
+    toolbox: {
+      feature: {
+        saveAsImage: {}
+      }
+    },
+    tooltip: {
+      trigger: 'axis',
+      axisPointer: {
+        type: 'cross',
+        label: {
+          backgroundColor: '#6a7985'
+        }
       },
     },
     dataZoom: [
       {
         type: 'inside',
+        start: 0,
+        end: 100
       },
+      {
+        start: 0,
+        end: 100
+      }
     ],
     series: [
       {
-        type: 'bar',
-        barWidth: '40%',
-        itemStyle: {
-          borderRadius: [5, 5, 0, 0],
-          color: '#188df0',
-        },
-        emphasis: {
-          itemStyle: {
-            color: '#188df0',
-          },
-        },
-        data: data,
+        name: '支出',
+        type: 'line',
+        stack: 'Total',
+        data: expenditureData,
+        smooth: true,
+      },
+      {
+        name: '支入',
+        type: 'line',
+        stack: 'Total',
+        data: depositData,
+        smooth: true,
+      },
+      {
+        name: '盈余',
+        type: 'line',
+        stack: 'Total',
+        data: surplusData,
+        smooth: true,
       },
     ],
   })
@@ -112,6 +121,7 @@ const setOptions = () => {
 
 onMounted(async() => {
   await nextTick()
+  await queryData()
   initChart()
 })
 

+ 6 - 1
web/src/view/dashboard/dashboardTable/dashboardTable.vue

@@ -38,7 +38,11 @@
           prop="collectionTime"
           label="完成日期"
           align="center"
-        />
+        >
+          <template #default="scope">
+            {{ dayjs(scope.row.collectionTime).format('YYYY-MM-DD') }}
+          </template>
+        </el-table-column>
       </el-table>
     </div>
   </div>
@@ -47,6 +51,7 @@
 <script setup>
 import { onMounted, reactive, ref } from 'vue'
 import { getProjectList } from '@/api/project'
+import { dayjs } from 'element-plus'
 
 const projectList = ref()
 

+ 3 - 3
web/src/view/dashboard/index.vue

@@ -18,16 +18,16 @@
       <div class="gva-card">
         <div class="gva-card-title">数据统计</div>
         <div class="p-4">
-          <el-row :gutter="20">
+          <el-row :gutter="10">
             <el-col
               :xs="24"
-              :sm="14"
+              :sm="13"
             >
               <echarts-line />
             </el-col>
             <el-col
               :xs="24"
-              :sm="10"
+              :sm="11"
             >
               <dashboard-table />
             </el-col>

+ 7 - 173
web/src/view/finance/workingHours/workingHours.vue

@@ -34,7 +34,7 @@
                 <el-option
                   v-for="item in constructorOptions"
                   :key="item.ID"
-                  :label="item.name"
+                  :label="item.nickName"
                   :value="item.ID"
                 />
               </el-select>
@@ -53,9 +53,6 @@
           </el-button>
           <template #dropdown>
             <el-dropdown-menu>
-              <el-dropdown-item @click="openConstructor = true">
-                施工人员
-              </el-dropdown-item>
               <el-dropdown-item @click="listSwitching(1)">
                 详情列表
               </el-dropdown-item>
@@ -75,7 +72,7 @@
             label="项目编号"
           />
           <el-table-column
-            prop="constructor.name"
+            prop="constructor.nickName"
             label="姓名"
           />
           <el-table-column
@@ -127,97 +124,6 @@
           @size-change="handleSizeChange"
         />
       </div>
-      <el-dialog
-        v-model="openConstructor"
-        title="施工人员"
-        width="800"
-        align-center
-      >
-        <el-collapse v-model="activeNames">
-          <el-collapse-item
-            title="操作"
-            name="1"
-          >
-            <el-form>
-              <el-form-item label="施工人员">
-                <el-input
-                  v-model="constructorData.name"
-                  style="width: 400px"
-                >
-                  <template #prepend>
-                    <el-select
-                      v-model="constructorData.id"
-                      placeholder="查询"
-                      style="width: 115px"
-                      clearable
-                      filterable
-                      @change="changeConstructor"
-                    >
-                      <el-option
-                        v-for="item in constructorOptions"
-                        :key="item.ID"
-                        :label="item.name"
-                        :value="item.ID"
-                      />
-                    </el-select>
-                  </template>
-                  <template #append>
-                    <el-button @click="erasureConstructor">删除</el-button>
-                  </template>
-                </el-input>
-              </el-form-item>
-              <el-form-item label="人天单价">
-                <el-input
-                  v-model="constructorData.onePrice"
-                  style="width: 400px"
-                />
-              </el-form-item>
-              <el-form-item>
-                <el-button @click="saveConstructor">保存</el-button>
-              </el-form-item>
-            </el-form>
-          </el-collapse-item>
-          <el-collapse-item
-            title="列表"
-            name="2"
-          >
-            <div>
-              <el-table :data="constructorTableData">
-                <el-table-column
-                  prop="name"
-                  label="姓名"
-                />
-                <el-table-column
-                  prop="onePrice"
-                  label="人天单价"
-                />
-              </el-table>
-              <div class="gva-pagination">
-                <el-pagination
-                  :current-page="searchData.pageInfo.page"
-                  :page-size="searchData.pageInfo.pageSize"
-                  :page-sizes="[10, 30, 50, 100]"
-                  :total="total"
-                  layout="total, sizes, prev, pager, next, jumper"
-                  @current-change="handleCurrentChange"
-                  @size-change="handleSizeChange"
-                />
-              </div>
-            </div>
-          </el-collapse-item>
-        </el-collapse>
-        <template #footer>
-          <div class="dialog-footer">
-            <el-button @click="openConstructor = false">取消</el-button>
-            <el-button
-              type="primary"
-              @click="openConstructor = false"
-            >
-              确定
-            </el-button>
-          </div>
-        </template>
-      </el-dialog>
       <!--      修改-->
       <el-dialog
         v-model="workingDialog"
@@ -235,7 +141,7 @@
             </el-form-item>
             <el-form-item label="人员">
               <el-input
-                v-model="workingHoursData.constructor.name"
+                v-model="workingHoursData.constructor.nickName"
                 disabled
               />
             </el-form-item>
@@ -266,25 +172,16 @@
 <script setup>
 import { ref, onMounted } from 'vue'
 import {
-  createConstructor,
-  deleteConstructor, deleteWorkingHours,
-  queryConstructor,
+  deleteWorkingHours,
   queryConstructorList, queryWorkingHoursList, queryWorkingHoursSum,
-  updateConstructor, updateWorkingHours
+  updateWorkingHours
 } from '@/api/finance'
 import { ElMessage, ElMessageBox } from 'element-plus'
+import { getAllUsers } from '@/api/user'
 
 // 施工人员----------------------------------------------------------------
 
-const activeNames = ref(['1'])
-const openConstructor = ref(false)
-
 const constructorOptions = ref()
-const constructorData = ref({
-  id: null,
-  name: '',
-  onePrice: null,
-})
 
 const searchData = ref({
   pageInfo: {
@@ -327,7 +224,7 @@ const workingHoursList = ref()
 const workingHoursSum = ref()
 
 const queryData = async() => {
-  await queryConstructor().then(res => {
+  await getAllUsers().then(res => {
     constructorOptions.value = res.data
   })
   await queryConstructorList(searchData.value).then(res => {
@@ -367,69 +264,6 @@ const listSwitching = async(val) => {
   isOpen.value = val
 }
 
-const changeConstructor = (val) => {
-  for (const key in constructorOptions.value) {
-    if (constructorOptions.value[key].ID === val) {
-      constructorData.value.name = constructorOptions.value[key].name
-      constructorData.value.onePrice = constructorOptions.value[key].onePrice
-    }
-  }
-}
-
-// 保存
-const saveConstructor = async() => {
-  if (constructorData.value.name === '' || constructorData.value.onePrice === null) {
-    ElMessage.error('数据不能为空')
-    return false
-  }
-  if (constructorData.value.id === null || constructorData.value.id === undefined) {
-    await createConstructor(constructorData.value).then(res => {
-      if (res.code === 0) {
-        ElMessage.success('新增成功')
-      }
-      queryData()
-    })
-  } else {
-    await updateConstructor(constructorData.value).then(res => {
-      if (res.code === 0) {
-        ElMessage.success('修改成功')
-      }
-      queryData()
-    })
-  }
-}
-
-// 删除
-const erasureConstructor = async() => {
-  if (constructorData.value.id === null) {
-    ElMessage.error('请选择人员')
-    return false
-  }
-  ElMessageBox.confirm(
-    '确定进行删除操作吗?',
-    '删除',
-    {
-      confirmButtonText: '确定',
-      cancelButtonText: '取消',
-      type: 'warning',
-    }
-  )
-    .then(async() => {
-      await deleteConstructor(constructorData.value).then(res => {
-        if (res.code === 0) {
-          ElMessage.success('删除成功')
-        }
-        queryData()
-      })
-    })
-    .catch(() => {
-      ElMessage({
-        type: 'info',
-        message: '取消删除',
-      })
-    })
-}
-
 // 工时
 const workingDialog = ref(false)
 const workingHoursData = ref()