From 3c049c574ae7f8f0dba0fc91339bbfb6e795ad67 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Tue, 03 Jan 2023 01:31:48 +0000
Subject: [PATCH] 项目日报

---
 eladmin-web-master/src/views/task/taskDaliy/index.vue |   83 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 76 insertions(+), 7 deletions(-)

diff --git a/eladmin-web-master/src/views/task/taskDaliy/index.vue b/eladmin-web-master/src/views/task/taskDaliy/index.vue
index f90fdd5..2a7ebe4 100644
--- a/eladmin-web-master/src/views/task/taskDaliy/index.vue
+++ b/eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -78,6 +78,21 @@
           <el-form-item label="消耗工作量单位" prop="consumedWorkloadUnit">
             {{ dict.label[standardWorkloadUnit][form.consumedWorkloadUnit] }}
           </el-form-item>
+          <el-form-item label="任务进度" prop="taskProgress">
+            <el-input v-model="form.taskProgress" style="width: 340px;">
+              <template slot="append">%</template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label="结算状态" prop="settlementStatus">
+            <el-select v-model="form.settlementStatus" filterable placeholder="请选择" style="width: 340px;">
+              <el-option
+                v-for="item in dict[settlementStatus]"
+                :key="item.id"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </el-form-item>
           <el-form-item label="备注">
             <el-input v-model="form.remarks" :rows="3" type="textarea" style="width: 340px;" />
           </el-form-item>
@@ -90,12 +105,12 @@
       <!--表格渲染-->
       <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
         <el-table-column type="selection" width="55" />
-        <el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期">
+        <el-table-column :show-overflow-tooltip="true" prop="fillDate" label="填写日期" fixed="left" width="100">
           <template slot-scope="scope">
             {{ crud.toDate(scope.row.fillDate) }}
           </template>
         </el-table-column>
-        <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" width="100">
+        <el-table-column :show-overflow-tooltip="true" prop="userNickName" label="所属用户" fixed="left" width="100">
           <template slot-scope="scope">
             <el-tag>{{ scope.row.userNickName }}</el-tag>
           </template>
@@ -110,16 +125,26 @@
             <el-tag>{{ scope.row.taskName }}</el-tag>
           </template>
         </el-table-column>
-        <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" />
-        <el-table-column :show-overflow-tooltip="true" prop="consumedWorkload" label="消耗工作量" />
+        <el-table-column :show-overflow-tooltip="true" prop="consumedHours" label="消耗工时" width="80" />
+        <el-table-column :show-overflow-tooltip="true" prop="consumedWorkload" label="消耗工作量" width="80" />
         <el-table-column :show-overflow-tooltip="true" prop="taskWorkloadUnit" label="消耗工作量单位" width="110">
           <template slot-scope="scope">
             <el-tag v-if="scope.row.taskWorkloadUnit != null && scope.row.taskWorkloadUnit != ''">{{ dict.label[standardWorkloadUnit][scope.row.taskWorkloadUnit] }}</el-tag>
           </template>
         </el-table-column>
+        <el-table-column :show-overflow-tooltip="true" prop="taskProgress" label="任务进度">
+          <template slot-scope="scope">
+            {{ scope.row.taskProgress }}%
+          </template>
+        </el-table-column>
+        <el-table-column :show-overflow-tooltip="true" prop="settlementStatus" label="结算状态">
+          <template slot-scope="scope">
+            <el-tag>{{ dict.label[settlementStatus][scope.row.settlementStatus] }}</el-tag>
+          </template>
+        </el-table-column>
         <el-table-column prop="remarks" label="备注" width="140" />
         <el-table-column prop="createTime" label="创建时间" width="140" />
-        <el-table-column v-if="checkPer(['admin','taskDaliy:edit','taskDaliy:del'])" label="操作" width="150px" align="center">
+        <el-table-column v-if="checkPer(['admin','taskDaliy:edit','taskDaliy:del'])" label="操作" width="150px" align="center" fixed="right">
           <template slot-scope="scope">
             <udOperation
               :data="scope.row"
@@ -146,12 +171,12 @@
 import crudProject from '@/api/project/project'
 import crudTask from '@/api/task/task'
 
-const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, consumedWorkload: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
+const defaultForm = { id: null, projectId: null, taskId: null, userId: null, fillDate: null, consumedHours: null, consumedWorkload: null, taskProgress: null, settlementStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
 export default {
   name: 'TaskDaliy',
   components: { pagination, crudOperation, rrOperation, udOperation },
   mixins: [presenter(), header(), form(defaultForm), crud()],
-  dicts: [constant.STANDARD_WORKLOAD_UNIT],
+  dicts: [constant.STANDARD_WORKLOAD_UNIT, constant.SETTLEMENT_STATUS],
   cruds() {
     return CRUD({ title: '任务日报', url: 'api/taskDaliy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTaskDaliy }})
   },
@@ -161,6 +186,15 @@
       const reg = /^([0-9]|[1-9]\d{1,2})(\.\d{1,2})?$|1000$/
       if (value != null && value !== '' && !reg.test(value)) {
         callback(new Error('请输入 一千 以内的正整数或两位小数'))
+      } else {
+        callback()
+      }
+    }
+    // 比例(百内)验证
+    var proportionValidate = (rule, value, callback) => {
+      const reg = /^([0-9]|[1-9]\d)(\.\d{1,2})?$|100$/
+      if (value != null && value !== '' && !reg.test(value)) {
+        callback(new Error('请输入 一百 以内的正整数或两位小数'))
       } else {
         callback()
       }
@@ -191,6 +225,13 @@
         ],
         consumedWorkload: [
           { validator: durationValidate, trigger: 'blur' }
+        ],
+        taskProgress: [
+          { required: true, message: '任务进度不能为空', trigger: 'blur' },
+          { validator: proportionValidate, trigger: 'blur' }
+        ],
+        settlementStatus: [
+          { required: true, message: '结算状态不能为空', trigger: 'change' }
         ]
       },
       queryTypeOptions: [
@@ -200,6 +241,8 @@
       ],
       // 字典:标准工作量单位
       standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
+      // 字典:结算状态
+      settlementStatus: constant.SETTLEMENT_STATUS,
       // 用户列表
       users: [],
       // 检索项目列表
@@ -253,6 +296,26 @@
         })
       }
     },
+    // 钩子:新建 - 之前
+    [CRUD.HOOK.beforeToAdd]() {
+      // 表单赋值
+      this.form.consumedWorkloadUnit = null
+    },
+    // 钩子:编辑 - 之前
+    [CRUD.HOOK.beforeToEdit]() {
+      // 获取项目
+      crudProject.getPartake({ taskUserId: this.form.userId, approveStatus: constant.APPROVE_STATUS_ACKNOWLEDGED }).then(res => {
+        // 表单项目列表
+        this.formProjects = res
+      })
+      // 获取任务
+      crudTask.getPartake({ taskUserId: this.form.userId, projectId: this.form.projectId }).then(res => {
+        // 表单任务列表
+        this.formTasks = res
+        // 表单任务变更
+        this.formTaskChange()
+      })
+    },
     // 表单用户变更
     formUserChange() {
       // 表单赋值
@@ -296,6 +359,12 @@
         if (this.formTasks[i].id === this.form.taskId) {
           // 表单赋值
           this.form.consumedWorkloadUnit = this.formTasks[i].planWorkloadUnit
+          return
+        }
+        // 判断循环是否结束
+        if (i === this.formTasks.length - 1) {
+          // 表单赋值
+          this.form.consumedWorkloadUnit = null
         }
       }
     }

--
Gitblit v1.9.3