zk 2 سال پیش
والد
کامیت
a9923a67d4
5فایلهای تغییر یافته به همراه31 افزوده شده و 24 حذف شده
  1. 19 20
      server/api/v1/autocode/unit.go
  2. 7 0
      server/main_test.go
  3. 1 0
      web/src/view/place/place.vue
  4. 2 2
      web/src/view/problemInfo/problemInfo.vue
  5. 2 2
      web/src/view/unit/unit.vue

+ 19 - 20
server/api/v1/autocode/unit.go

@@ -9,7 +9,6 @@ import (
 	"github.com/flipped-aurora/gin-vue-admin/server/service"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
-	"time"
 )
 
 type UnitApi struct {
@@ -29,25 +28,25 @@ var unitService = service.ServiceGroupApp.AutoCodeServiceGroup.UnitService
 func (unitApi *UnitApi) CreateUnit(c *gin.Context) {
 	var unit autocode.Unit
 	_ = c.ShouldBindJSON(&unit)
-	if err, nowUnit := unitService.GetUnitTop(); err != nil {
-		//新建期数
-		unit.Period = time.Now().Format("20060102150405")
-		integral := 1000
-		unit.UnitIntegral = &integral
-		unit.UnitMaxIntegral = &integral
-		unitService.CreateUnit(unit)
-		response.OkWithMessage("创建成功", c)
-	} else {
-		unit.UnitIntegral = nowUnit.UnitMaxIntegral
-		unit.UnitMaxIntegral = nowUnit.UnitMaxIntegral
-		unit.Period = nowUnit.Period
-		if err := unitService.CreateUnit(unit); err != nil {
-			global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
-			response.FailWithMessage("创建失败", c)
-		} else {
-			response.OkWithMessage("创建成功", c)
-		}
-	}
+	//if err, nowUnit := unitService.GetUnitTop(); err != nil {
+	//新建期数
+	//unit.Period = time.Now().Format("20060102150405")
+	integral := 0
+	unit.UnitIntegral = &integral
+	unit.UnitMaxIntegral = &integral
+	unitService.CreateUnit(unit)
+	response.OkWithMessage("创建成功", c)
+	//} else {
+	//	unit.UnitIntegral = nowUnit.UnitMaxIntegral
+	//	unit.UnitMaxIntegral = nowUnit.UnitMaxIntegral
+	//	unit.Period = nowUnit.Period
+	//	if err := unitService.CreateUnit(unit); err != nil {
+	//		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
+	//		response.FailWithMessage("创建失败", c)
+	//	} else {
+	//		response.OkWithMessage("创建成功", c)
+	//	}
+	//}
 }
 
 // DeleteUnit 删除Unit

+ 7 - 0
server/main_test.go

@@ -1,11 +1,13 @@
 package main
 
 import (
+	"fmt"
 	"github.com/flipped-aurora/gin-vue-admin/server/core"
 	"github.com/flipped-aurora/gin-vue-admin/server/global"
 	"github.com/flipped-aurora/gin-vue-admin/server/initialize"
 	"github.com/silenceper/wechat/v2/officialaccount/menu"
 	"go.uber.org/zap"
+	"strconv"
 	"testing"
 )
 
@@ -74,3 +76,8 @@ func TestName(t *testing.T) {
 	//	fmt.Println()
 	//}
 }
+
+func TestAaaa(t *testing.T) {
+	id, _ := strconv.Atoi("37")
+	fmt.Println(uint(id))
+}

+ 1 - 0
web/src/view/place/place.vue

@@ -364,6 +364,7 @@ export default {
           res = await createPlace(this.formData)
           break
         case 'update':
+          this.formData.unitMaxIntegral = parseInt(this.formData.unitMaxIntegral)
           res = await updatePlace(this.formData)
           break
         default:

+ 2 - 2
web/src/view/problemInfo/problemInfo.vue

@@ -54,7 +54,7 @@
       </el-table-column>
       <el-table-column label="已登录查阅次数" prop="count" />
       <el-table-column label="扣评分" prop="integral">
-        <template #default="scope">{{ scope.row.integral/10 }}</template>
+        <template #default="scope">{{ scope.row.integral/100 }}</template>
       </el-table-column>
       <el-table-column label="处理状态" prop="status">
         <template #default="scope">
@@ -161,7 +161,7 @@
             <el-descriptions-item label="处理时限" prop="HandAt">
               <template #default="scope">{{ formatDate(formData.HandAt) }}</template>
             </el-descriptions-item>
-            <el-descriptions-item label="扣评分">{{ formData.integral/10 }}</el-descriptions-item>
+            <el-descriptions-item label="扣评分">{{ formData.integral/100 }}</el-descriptions-item>
             <el-descriptions-item span="2" label="问题备注">{{ formData.remark }}</el-descriptions-item>
           </el-descriptions>
         </el-card>

+ 2 - 2
web/src/view/unit/unit.vue

@@ -57,7 +57,7 @@
         <template #default="scope">{{ (scope.row.unitMaxIntegral-scope.row.unitIntegral)/100 }}</template>
       </el-table-column>
       <el-table-column label="得分率">
-        <template #default="scope">{{ ((scope.row.unitMaxIntegral-scope.row.unitIntegral)/scope.row.unitMaxIntegral).toFixed(4)*100 }} %</template>
+        <template #default="scope">{{ ((scope.row.unitMaxIntegral-scope.row.unitIntegral)/scope.row.unitMaxIntegral).toFixed(4)*100?((scope.row.unitMaxIntegral-scope.row.unitIntegral)/scope.row.unitMaxIntegral).toFixed(4)*100:0 }} %</template>
       </el-table-column>
       <el-table-column label="按钮组">
         <template #default="scope">
@@ -192,7 +192,7 @@
           <el-table-column label="已登录查阅次数" prop="count" />
           <el-table-column label="一类部门" prop="unitName" />
           <el-table-column label="扣评分" prop="integral">
-            <template #default="scope">{{ scope.row.integral/10 }}</template>
+            <template #default="scope">{{ scope.row.integral/100 }}</template>
           </el-table-column>
           <el-table-column label="处理状态" prop="status">
             <template #default="scope">