Selaa lähdekoodia

月报编辑页面:页面状态判断逻辑添加

洪海涛 4 vuotta sitten
vanhempi
sitoutus
f18bf00d39

+ 31 - 5
src/views/monthlyReport/childrenPage/editReport/components/MrTable.vue

@@ -44,7 +44,7 @@
               :key="btnIndex"
             >
               <el-button
-                v-if="isShowButton(scope.row)"
+                v-if="isShowButton(scope.row, item)"
                 size="mini"
                 type="text"
                 @click="btnFun(btnItem, scope)"
@@ -257,7 +257,8 @@ export default {
   data() {
     this.setAnalyticFeedback = _.debounce(this.setAnalyticFeedback, 3000)
     return {
-      analyticFeedback: ''
+      analyticFeedback: '',
+      username: localStorage.getItem('username')
     }
   },
   computed: {
@@ -273,6 +274,9 @@ export default {
     tabsActive() {
       return this.$store.state.monthlyReportEdit.tabsActive
     },
+    pageDate() {
+      return this.$store.state.monthlyReportEdit.pageDate
+    },
     editKeys() {
       return this.$store.state.monthlyReportEdit.editKeys
     }
@@ -405,7 +409,7 @@ export default {
     },
     // 查看页面数据分析
     setAnalyticFeedback() {
-      if (this.pageType !== 'edit') {
+      if (this.pageType !== 'edit' && this.tabsActive.indexOf('本月重点问题') > -1) {
         // this.$refs.Analysis.open()
         console.log(this.domKey)
         const tabPageData = reportDataBack(_.cloneDeep(this.tabPageData))
@@ -437,13 +441,35 @@ export default {
         // console.log(this.title)
       }
     },
-    // 操作按钮是否显示隐藏
+    /**
+     * 操作按钮是否显示隐藏
+     * 1、首先判断 页面 为编辑页面时 展示所有按钮
+     * 2、判读分析反馈是否已经提交,已经提交的话,不展示按钮
+     * 3、再判断当前表格是否有责任人
+     *      有责任人
+     *        判断当前用户是否存在负责人中,存在展示按钮,不存在则不展示
+     *      无责任人不展示按钮
+     * @param row 表格行数据
+     * @returns {boolean}
+     */
     isShowButton(row) {
       if (this.pageType === 'edit') return true
       if (row.analyticFeedback && row.analyticFeedback.isCommitted) {
         return false
       }
-      return true
+      // 默认所有情况都展示
+      if (this.pageType) {
+        return true
+      }
+      if (this.pageDate.createBy === this.username) return true
+      for (let i = 0; i < this.columns.length; i++) {
+        const elm = this.columns[i]
+        if (elm.name === '责任人') {
+          if (!row[elm.headrKey]) return false
+          return row[elm.headrKey].indexOf(this.username) > -1
+        }
+      }
+      return false
     }
   }
 }

+ 3 - 1
src/views/monthlyReport/childrenPage/editReport/components/MultiplePeopleInfo.vue

@@ -80,7 +80,9 @@ export default {
                   value: elm.name
                 })
                 this.userName.push(elm.name)
-                cb()
+                setTimeout(() => {
+                  cb()
+                }, 500)
                 return
               }
             }

+ 7 - 2
src/views/monthlyReport/childrenPage/editReport/components/TableExpandRow.vue

@@ -65,13 +65,13 @@ style="min-width: 50px;display: inline-block;"
               class="up-progress"
               :style="{ width: !subItem.isHold ? '80px' : '80px' }"
               ><span
-v-if="!subItem.isHold"
+v-if="(!subItem.personInCharge || subItem.personInCharge.indexOf(username) > -1) && !subItem.isHold"
 @click="progressEdit(subItem)"
                 >进度更新</span
               ></span
             >
             <!--改进项: Hold-->
-            <span class="Hold" @click="setHold(index, subIndex, subItem)">{{
+            <span v-if="!subItem.personInCharge || subItem.personInCharge.indexOf(username) > -1" class="Hold" @click="setHold(index, subIndex, subItem)">{{
               subItem.isHold ? '解除Hold' : 'Hold'
             }}</span>
           </div>
@@ -98,6 +98,11 @@ export default {
       default: null
     }
   },
+  data() {
+    return {
+      username: localStorage.getItem('username')
+    }
+  },
   methods: {
     setHold(index, subIndex, subItem) {
       subItem.isProgressEdit = false

+ 5 - 11
src/views/monthlyReport/childrenPage/editReport/index.vue

@@ -1,20 +1,23 @@
 <template>
   <div ref="pageWrapper" class="page-wrapper" @click="setInit">
     <headerCom title="月报" :sub-title="subTitle" address="/monthlyReport/index">
-      <template v-if="pageType === 'edit'" slot="content">
+      <template v-if="pageDate && pageDate.status === 0" slot="content">
         <el-button
+          v-if="pageDate && pageDate.status < 2"
 type="primary"
 size="small"
 @click="upDateReport"
           >保存
         </el-button>
         <el-button
+          v-if="pageDate && pageDate.status < 2"
 plain
 size="small"
 @click="dialogOpen('dialogSend')"
           >发送确认
         </el-button>
         <el-button
+          v-if="pageDate && pageDate.status < 1"
           slot="reference"
           plain
           size="small"
@@ -22,22 +25,13 @@ size="small"
           >取消
         </el-button>
         <el-button
-          v-if="pageDate && pageDate.status === 0"
+          v-if="pageDate && pageDate.status < 2"
           slot="reference"
           plain
           size="small"
           @click="dialogOpen('dialogDelete')"
           >删除
         </el-button>
-        <el-button
-          v-if="pageDate && pageDate.status === 0"
-          slot="reference"
-          plain
-          size="small"
-          @click="dialogOpen('dialogDelete')"
-        >删除
-        </el-button>
-
       </template>
     </headerCom>
     <!--     <div style="position: fixed;z-index: 99; top: 20px">