朱鑫波 4 gadi atpakaļ
vecāks
revīzija
0ef0970328
1 mainītis faili ar 104 papildinājumiem un 9 dzēšanām
  1. 104 9
      src/views/OKRpage.vue

+ 104 - 9
src/views/OKRpage.vue

@@ -239,7 +239,7 @@
                 <el-popover
                   placement="top-start"
                   width="500"
-                  trigger="hover"
+                  trigger="click"
                   @show="getAlignmentList(ele)"
                 >
                   <!-- 
@@ -247,7 +247,36 @@
                   :content="'详细描述:' + (ele.krDesc || '暂无')" -->
                   <h2>{{ "KR:" + ele.krInfo }}</h2>
                   <p>{{ "详细描述:" + (ele.krDesc || "暂无") }}</p>
-                  <div style="text-align: right; margin: 0">
+
+                  <h2>对齐KR</h2>
+                  <div>
+                    <ul>
+                      <li
+                        v-for="(list, indexOne) in Alignment"
+                        style="display: flex; justify-content: space-between"
+                      >
+                        <p
+                          style="
+                            display: flex;
+                            justify-content: space-between;
+                            width: 100%;
+                          "
+                        >
+                          {{ list.krInfo }}
+
+                          <a
+                            @click="deleteAlignment(list.id, ele)"
+                            style="
+                              white-space: nowrap;
+                              margin-left: 20px;
+                              cursor: pointer;
+                              color: red;
+                            "
+                            >删除</a
+                          >
+                        </p>
+                      </li>
+                    </ul>
                     <!-- <el-button size="mini" type="text" @click="visible = false"
                       >取消</el-button
                     >
@@ -1070,8 +1099,26 @@
       center
       :before-close="OKRhandleClose"
     >
-      <!-- 人员筛选
+      <!-- 
       {{ checkedCities }} -->
+      <div style="margin-bottom: 15px">
+        人员筛选:
+        <el-select
+          v-model="person"
+          filterable
+          placeholder="请选择"
+          @change="getAlignmentPerson"
+        >
+          <el-option
+            v-for="item in optionsPerson"
+            :key="item.userId"
+            :label="item.name"
+            :value="item.userId"
+          >
+          </el-option>
+        </el-select>
+      </div>
+
       <ul
         class="infinite-list"
         v-infinite-scroll="getAlignmentPageList"
@@ -1094,7 +1141,10 @@
 
       <span slot="footer" class="dialog-footer">
         <el-button @click="AlignmentVisible = false">取 消</el-button>
-        <el-button type="warning" @click="addAlignmentPageList"
+        <el-button
+          type="warning"
+          @click="addAlignmentPageList"
+          :loading="okLoading"
           >添 加</el-button
         >
       </span>
@@ -1135,11 +1185,15 @@ export default {
   components: { Treeselect },
   data() {
     return {
+      okLoading: false,
+      optionsPerson: [],
+      person: "",
       AlignmentVisible: false, //添加对齐
       alignmentList: [], //添加对齐列表
       alignmentPage: 1,
       checkedCities: [],
       krId: null,
+      Alignment: [],
       yearValue: undefined,
       cycleValue: undefined,
       yearsOptions: [],
@@ -1288,16 +1342,27 @@ export default {
   methods: {
     //添加对齐
     addAlignmentPageList() {
+      this.okLoading = true;
       postAction(
-        `/okr/kr/alignList?originId=${this.krId}&alignId=${JSON.stringify(
-          this.checkedCities
-        )}`
+        `/okr/kr/addAlign?originId=${
+          this.krId
+        }&alignId=${this.checkedCities.join()}`
       ).then((res) => {
-        console.log(res);
+        if (res.success) {
+          this.$message.success("添加对齐成功");
+          this.AlignmentVisible = false;
+          this.alignmentPage = 1;
+          this.okLoading = false;
+        }else{
+          this.$message.success(res.message);
+           this.okLoading = false;
+        }
       });
     },
     //设置对齐的列表
     setAlignment(ele) {
+      this.checkedCities = [];
+      this.person = "";
       this.AlignmentVisible = true;
       this.krId = ele.id;
       getAction("/okr/kr/list", {
@@ -1305,11 +1370,24 @@ export default {
         quarter: 4,
         pageSize: 10,
         pageNo: 1,
+        userId: this.person,
       }).then((res) => {
         if (res.success) {
           this.alignmentList = res.result.records;
         }
       });
+
+      postAction("/okr/qywx/getUserListByName", {}).then((res) => {
+        console.log(res);
+        if (res.success) {
+          this.optionsPerson = res.result;
+        }
+      });
+    },
+    getAlignmentPerson() {
+      this.alignmentPage = 0;
+      this.alignmentList = [];
+      this.getAlignmentPageList();
     },
     //滚动加载
     getAlignmentPageList() {
@@ -1319,6 +1397,7 @@ export default {
         quarter: 4,
         pageSize: 10,
         pageNo: this.alignmentPage,
+        userId: this.person,
       }).then((res) => {
         if (res.success) {
           this.alignmentList.push(...res.result.records);
@@ -1328,10 +1407,26 @@ export default {
     //获取对齐的详情列表
     getAlignmentList(ele) {
       console.log(ele);
+      this.Alignment = [];
       postAction(`/okr/kr/alignList?originId=${ele.id}`).then((res) => {
-        console.log(res);
+        if (res.success) {
+          this.Alignment.push(...res.data);
+        }
       });
     },
+    //删除对齐
+    deleteAlignment(id, ele) {
+      postAction(`/okr/kr/deleteAlign?originId=${ele.id}&alignId=${id}`).then(
+        (res) => {
+          if (res.success) {
+            this.$message.success("删除成功");
+            this.getAlignmentList(ele);
+          } else {
+            this.$message.error("删除失败");
+          }
+        }
+      );
+    },
     taskPowerChange(val) {
       console.log(val);