Bladeren bron

大中型在审核产品阶段分配人员绩效

wucl 4 maanden geleden
bovenliggende
commit
aed4980a2a
1 gewijzigde bestanden met toevoegingen van 146 en 53 verwijderingen
  1. 146 53
      src/views/major/todoDetail.vue

+ 146 - 53
src/views/major/todoDetail.vue

@@ -1104,8 +1104,7 @@
             <template slot-scope="props">
               <el-button round type="danger" @click="saveProduction(props.row)"
                 :disabled="!updateProductionNode.includes(currentNode.nodeCode)">更新产品信息</el-button>
-              <el-button type="success" round v-if="doWare" @click="openWareHouseDialog(props.row)">{{
-                currentNode.nodeName }}</el-button>
+              <el-button v-if="currentNode.nodeCode=='CHECK_STATEMENT' || currentNode.nodeCode=='CHECK_REPORT' || currentNode.nodeCode=='CHECK_LETTER'" type="success" round @click="openAllotDialog(props.row)">分配人员绩效</el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -1663,13 +1662,42 @@
         </div>
       </el-card>
     </el-dialog>
-    <el-dialog :visible.sync="warehouseDialog" width="25%" center top="35vh" custom-class="doWarehouseClass"
-      @closed="cleanWareHouseProductionType()">
-      <ScanEntry ref="scanEntry" @scanEntryFun="handleScanEntry" label="请扫描二维码或输入产品号" />
-      <span slot="footer" class="dialog-footer">
-        <el-button @click="warehouseDialog = false">取 消</el-button>
-        <el-button type="primary" @click="doWareHouse()">确 定</el-button>
-      </span>
+    <el-dialog :visible.sync="allotDialog" width="75%" center custom-class="doWarehouseClass">
+      <el-form ref="allotPerformanceForm" :model="allotPerformance" class="form-container">
+        <div class="createMajor-main-container">
+          <div class="postInfo-container">
+            <el-row>
+              <el-col :xs="24" :sm="12" :lg="24" :span="6">
+                <el-button style="float:right" type="success" @click="saveAllot()">确认分配</el-button>
+              </el-col>
+            </el-row>
+            <div>
+              <el-divider content-position="left">
+                <h3 class="title">{{ reportNo }} 绩效分配</h3>
+              </el-divider>
+            </div>
+            <el-row class="row-style" v-if="allotPerformance.performanceList.length > 0">
+              <el-col :xs="24" :sm="12" :lg="6" :span="6" v-for="(a, index) in allotPerformance.performanceList">
+                <el-card shadow="always" style="margin-top:30px;margin-right:15px;margin-bottom:30px;">
+                  <span v-if="a.isPrincipal" style="position:absolute; top:35px;left :87px"><el-tag
+                      type="danger">项目负责人</el-tag></span>
+                  <div class="performance-avatar-wrapper perfomance-icon-title">{{ a.userName.slice(-2) }}</div>
+                  <el-input v-model.number="a.ratio" type="number" style="width:80%;margin-left:5px">
+                    <template slot="append">%</template>
+                  </el-input>
+                </el-card>
+              </el-col>
+            </el-row>
+            <el-row class="row-style">
+              <el-select style="margin-right: 15px;width: 20%;" v-model="needAddToPerformanceUsers"
+                placeholder="请选择要添加的人员" multiple filterable clearable>
+                <el-option v-for="(u, id) in allUsers" :label="u.name" :value="u" :key="u.id"></el-option>
+              </el-select>
+              <el-button type="primary" @click="addToPerformanceUsers()">添加</el-button>
+            </el-row>
+          </div>
+        </div>
+      </el-form>
     </el-dialog>
     <el-dialog :visible.sync="checkFundDialog" width="25%" center top="35vh" custom-class="doWarehouseClass">
       <el-row>
@@ -2145,7 +2173,7 @@ export default {
       tCustomerCompany: [],
       tSubCustomerCompany: [],
       tCustomerContract: [],
-      warehouseDialog: false,
+      allotDialog: false,
       scanEntryData: null,
       wareHouseProductionType: null,
       doWare: false,
@@ -2192,7 +2220,12 @@ export default {
       refuseForm:{
         reason:null
       },
-      year: '2025'
+      year: '2025',
+      allotPerformance: {
+        performanceList: [],
+        majorProductionId: null
+      },
+      needAddToPerformanceUsers: []
     }
   },
   created() {
@@ -3600,50 +3633,29 @@ export default {
         })
       }
     },
-    doWareHouse() {
-      let reportNo = this.scanEntryData
-      let wareHoaseDto = new Object();
-      if (reportNo) {
-        wareHoaseDto.reportNo = reportNo;
-      } else {
-        wareHoaseDto.reportNo = this.$refs.scanEntry.scanEntryData;
-      }
-      if (this.currentNode.nodeName.includes("入库")) {
-        wareHoaseDto.repertoryState = 0;
-      } else {
-        wareHoaseDto.repertoryState = 1;
-      }
-      wareHoaseDto.productionType = this.wareHouseProductionType;
-      wareHoaseDto.productionId = this.wareHouseproductionId;
-      this.taskRecordDTO.recordId = this.currentNode.tasks[0].recordId;
-      this.taskRecordDTO.taskData = wareHoaseDto;
-      this.$api.majorProduction.warehouse(this.taskRecordDTO).then(res => {
-        if (res.code === 200 && res.data) {
-          this.$notify({
-            title: '成功',
-            message: '库存操作成功',
-            type: 'success',
-            duration: 1000,
-            offset: 100
-          });
-          this.warehouseDialog = false;
-          this.getProductions(this.majorId, wareHoaseDto.reportNo);
-        }
-        else {
-          this.$message({
-            type: 'info',
-            message: '取消操作'
-          });
-        }
-      })
-    },
+   
     handleScanEntry(scanData) {
       this.scanEntryData = scanData;
     },
-    openWareHouseDialog(row) {
-      this.warehouseDialog = true;
-      this.wareHouseProductionType = row.production;
-      this.wareHouseproductionId = row.id
+    openAllotDialog(row) {
+      this.getAllUser();
+      this.allotDialog = true;
+      this.reportNo = row.reportNo;
+      this.allotPerformance.majorProductionId = row.id;
+      this.majorId = row.majorId;
+      this.$api.majorPerformanceAllot.list(row.id).then(res => {
+        if (res.code === 200) {
+          const list = res.data;
+          for (let i in list) {
+            if (list[i].ratio == null) {
+              list[i].ratio = 0;
+            } else {
+              list[i].ratio = (list[i].ratio) * 100;
+            }
+          }
+          this.allotPerformance.performanceList = list;
+        }
+      })
     },
     cleanWareHouseProductionType() {
       this.wareHouseProductionType = null;
@@ -4004,7 +4016,71 @@ export default {
     remindClean(){
       this.passNotRecord = false;
       this.passNotSubmit = false;
-    }
+    },
+    saveAllot() {
+      const id = this.allotPerformance.majorProductionId;
+      const list = this.allotPerformance.performanceList;
+      let total = 0;
+      list.map(function (item) {
+        total += item.ratio;
+      })
+      if (total != 100) {
+        this.$notify({
+          title: '提示',
+          message: '绩效分配之和需等于100,请检查。',
+          type: 'warning',
+          duration: 2000
+        });
+        return;
+      }
+      for (let i in list) {
+        list[i].majorProductionId = id;
+        list[i].ratio = (list[i].ratio) / 100;
+        list[i].userType = 'EVALUATE';
+        list[i].majorId = this.majorId;
+      }
+      this.$api.majorPerformanceAllot.allot(list).then(res => {
+        if (res.code === 200 && res.data) {
+          this.$notify({
+            title: '成功',
+            message: '保存成功',
+            type: 'success',
+            duration: 2000
+          });
+          this.allotDialog = false;
+          this.getList();
+        } else {
+          this.$notify({
+            title: '失败',
+            message: '保存失败',
+            type: 'error',
+            duration: 2000
+          });
+        }
+      })
+    },
+    addToPerformanceUsers() {
+      this.needAddToPerformanceUsers.forEach((item) => {
+        let user = {
+          ratio: 0,
+          isPrincipal: false,
+          userId: item.id,
+          userName: item.name,
+          id: null,
+          created: null,
+          modified: null,
+          majorId: null,
+          majorProductionId: null,
+          declareId: null,
+          userType: null
+        }
+        // 判断要添加的人员是否已经存在了,已存在的跳过
+        if (!this.allotPerformance.performanceList.some(user => user.userId === item.id)) {
+          this.allotPerformance.performanceList.push(user);
+        }
+      });
+      this.needAddToPerformanceUsers = [];
+    },
   },
 }
 </script>
@@ -4117,4 +4193,21 @@ a:hover{
   color: black;
   z-index: 999;
 }
+.performance-avatar-wrapper {
+  width: 50px;
+  height: 50px;
+  position: relative;
+  border-radius: 50%;
+  background-color: rgba(129, 216, 207, 1);
+  text-align: center;
+  line-height: 50px;
+}
+
+.perfomance-icon-title {
+  font-size: 20px;
+  color: rgba(255, 255, 255, 1);
+  display: inline-block;
+  position: relative;
+  top: -2px;
+}
 </style>