瀏覽代碼

部门修复

xu 7 月之前
父節點
當前提交
a286fe8ceb

+ 9 - 9
server/dao/department.go

@@ -3,13 +3,13 @@ package dao
 import "server/global"
 
 type Department struct {
-	Id            int       `gorm:"primarykey" from:"id" json:"ID"`
-	Name          string    `json:"name" from:"name" gorm:"comment:部门名称"`
-	Desc          string    `json:"desc" from:"desc" gorm:"comment:部门描述"`
-	PrincipalId   int       `json:"principalId" from:"principal_id" gorm:"comment:负责人id"`
-	PrincipalName string    `json:"principalName" from:"principal_name" gorm:"comment:负责人姓名"`
-	Users         []SysUser `json:"users" gorm:"-"`
-	IsStart       bool      `json:"isStart" from:"is_start" gorm:"comment:是否启用"`
+	Id          int       `gorm:"primarykey" from:"id" json:"ID"`
+	Name        string    `json:"name" from:"name" gorm:"comment:部门名称"`
+	Desc        string    `json:"desc" from:"desc" gorm:"comment:部门描述"`
+	PrincipalId int       `json:"principalId" from:"principal_id" gorm:"comment:负责人id"`
+	Principal   SysUser   `json:"principal" from:"principal" gorm:"foreignKey:PrincipalId;references:id;"`
+	Users       []SysUser `json:"users" gorm:"-"`
+	IsStart     bool      `json:"isStart" from:"is_start" gorm:"comment:是否启用"`
 }
 
 func (Department) TableName() string {
@@ -20,7 +20,7 @@ func (Department) TableName() string {
 
 // QueryAllDep 查询所有部门
 func QueryAllDep() (deps []Department, err error) {
-	err = global.GVA_DB.Model(&Department{}).Find(&deps).Error
+	err = global.GVA_DB.Model(&Department{}).Preload("Principal").Find(&deps).Error
 	return deps, err
 }
 
@@ -37,7 +37,7 @@ func QueryUsersByDepId(depId int) (users []SysUser, err error) {
 }
 
 func QueryDepById(id int) (dep Department, err error) {
-	err = global.GVA_DB.Model(&Department{}).Where("id = ?", id).First(&dep).Error
+	err = global.GVA_DB.Model(&Department{}).Where("id = ?", id).Preload("Principal").First(&dep).Error
 	return dep, err
 }
 

+ 1 - 1
server/dao/project.go

@@ -133,7 +133,7 @@ func QueryProjectSum(code string) (projectSum ProjectSum, err error) {
 		return txErr
 	})
 	// 使用decimal 防止精度不准
-	exponent := decimal.NewFromFloatWithExponent(projectSum.TotalProjectAmount-projectSum.TotalCollectionAmount, 2)
+	exponent := decimal.NewFromFloatWithExponent(projectSum.TotalProjectAmount-projectSum.TotalCollectionAmount, -2)
 	projectSum.Receivables = exponent.InexactFloat64()
 	return
 }

+ 1 - 1
server/initialize/job.go

@@ -9,7 +9,7 @@ import (
 func MyJob() {
 	c := cron.New()
 
-	c.AddFunc("0 0/2 * * * ?", func() {
+	c.AddFunc("0 0 0/1 * * ?", func() {
 		err := dao.CreateProjectMonthFee()
 		if err != nil {
 			global.GVA_LOG.Error("CreateProjectMonthFee ====== " + err.Error())

+ 0 - 2
server/service/admin/department.go

@@ -33,8 +33,6 @@ func (ds *DepartmentService) QueryDepByStart() ([]dao.Department, error) {
 }
 
 func (ds *DepartmentService) CreateDep(department dao.Department) error {
-	user, _ := dao.QueryUserByUserId(uint(department.PrincipalId))
-	department.PrincipalName = user.NickName
 	return department.CreateDep()
 }
 

+ 5 - 0
server/service/admin/expenses.go

@@ -3,6 +3,7 @@ package admin
 import (
 	"server/dao"
 	"server/model/common/request"
+	"server/utils"
 )
 
 type ExpensesService struct{}
@@ -39,6 +40,10 @@ func (es *ExpensesService) QueryExpensesSumByPeople(info request.SearchExpenses)
 		expenses[i].Expenses = list
 		expenses[i].Department = deps
 		expenses[i].SysUser = user
+
+		expenses[i].DepositAmountSum = utils.AccuratePrice(expens.DepositAmountSum)
+		expenses[i].ExpenditureAmountSum = utils.AccuratePrice(expens.ExpenditureAmountSum)
+
 	}
 	return expenses, total, err
 }

+ 7 - 0
server/utils/comm.go

@@ -0,0 +1,7 @@
+package utils
+
+import "github.com/shopspring/decimal"
+
+func AccuratePrice(f float64) float64 {
+	return decimal.NewFromFloatWithExponent(f, -2).InexactFloat64()
+}

+ 3 - 3
web/src/view/department/department.vue

@@ -31,7 +31,7 @@
           label="部门描述"
         />
         <el-table-column
-          prop="principalName"
+          prop="principal.nickName"
           label="部门负责人"
         />
         <el-table-column
@@ -50,7 +50,6 @@
           <template #default="scope">
             <el-button
               icon="edit"
-
               type="primary"
               link
               @click="handleEditDep(scope.row)"
@@ -59,7 +58,6 @@
             </el-button>
             <el-button
               icon="delete"
-
               type="primary"
               link
               @click="handleDeleteDep(scope.row)"
@@ -286,6 +284,7 @@ const depTableData = ref([])
 const queryData = async() => {
   await getAllDep().then(res => {
     depTableData.value = res.data
+    console.log(depTableData.value)
   })
   await getAllUsers().then(res => {
     userOptions.value = res.data
@@ -325,6 +324,7 @@ const handleEditDep = (row) => {
 }
 
 const handleUpdateDep = async() => {
+  console.log(updateDepFromData.value)
   await updateDep(updateDepFromData.value).then(res => {
     if (res.code === 0) {
       ElMessage.success('更新成功')

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

@@ -53,6 +53,12 @@
               align="center"
               width="250px"
             />
+            <el-table-column
+              label="银行流水单号"
+              prop="serialNumber"
+              align="center"
+              width="250px"
+            />
             <el-table-column
               label="操作"
               align="center"
@@ -137,6 +143,15 @@
             clearable
           />
         </el-form-item>
+        <el-form-item
+          label="银行流水单号:"
+          size="large"
+        >
+          <el-input
+            v-model="paymentEditData.serialNumber"
+            placeholder="可输入银行流水单号(选填)"
+          />
+        </el-form-item>
         <el-form-item
           label="收款备注:"
           size="large"