HZH 4 år sedan
förälder
incheckning
4dd6ee81a7

+ 5 - 0
src/components/MainPage.vue

@@ -184,6 +184,11 @@ export default {
           return this.$route.name == 'Month'
       },
   },
+  watch: {
+    '$store.state.curPlanSin'(val){
+      this.getCurrent();
+    }
+  },
   methods: {
     getCurrent(){
       let currentYear = new Date().getFullYear();

+ 14 - 20
src/components/MainPage/Quarter.vue

@@ -67,18 +67,18 @@ table{
       placeholder="选择年"
       @change="getPlanList">
     </el-date-picker>
-    <el-button type="primary" @click="visibleChange = true;" v-if="ableEdit">新增季度计划</el-button>
+    <el-button type="primary" @click="visibleChange = true;">新增季度计划</el-button>
   </div>
   <table>
     <thead>
             <tr>
                 <th>计划名</th>
-                <th>部门</th>
+                <th style="min-width:50px">部门</th>
                 <!-- <th>参与成员</th> -->
                 <th>年份</th>
-                <th>季度</th>
+                <th style="width:50px">季度</th>
                 <th>简要说明</th>
-                <th style="width:150px" v-if="ableEdit">操作</th>
+                <th style="width:150px">操作</th>
             </tr>
         </thead>
         <tbody>
@@ -89,9 +89,13 @@ table{
               <td>{{item.year}}</td>
               <td>{{item.quarter}}</td>
               <td>{{item.content}}</td>
-              <td v-if="ableEdit">
+              <td>
+                <a @click="changeData(item,true)">详情</a>
+                &nbsp;&nbsp;
                 <a @click="changeData(item)">修改</a>
                 &nbsp;&nbsp;
+                <a @click="changeData(item)">子项</a>
+                &nbsp;&nbsp;
                 <a @click="visibleDelete = true;plan.id = item.id">删除</a>
                 &nbsp;&nbsp;
                 <a>完成</a>
@@ -101,7 +105,7 @@ table{
   </table>
   <el-dialog
         class="dialog-style"
-        title="编辑"
+        :title="noEdit?'详情':'编辑'"
         :visible.sync="visibleChange"
         width="500px">
         <div>
@@ -166,24 +170,13 @@ export default {
           year: ''
         },
         visibleChange: false,
-        visibleDelete: false
+        visibleDelete: false,
+        noEdit: false
       }
   },
   created() {
     this.getPlanList();
   },
-  computed: {
-      ableEdit() {
-          // return this.$store.state.loginUser.id == this.$store.state.checkUser.id;
-          return true;
-      },
-  },
-  watch: {
-    // '$store.state.checkUser.id'(val){
-    //   this.params.userId = val;
-    //   this.getPlanList();
-    // }
-  },
   methods: {
     getPlanList(){
       let params = JSON.parse(JSON.stringify(this.params));
@@ -200,8 +193,9 @@ export default {
         this.getPlanList();
       })
     },
-    changeData(item){
+    changeData(item,flag){
       this.visibleChange = true;
+      this.noEdit = flag;
       this.plan = JSON.parse(JSON.stringify( item ));
       this.yearData = new Date(item.year,1,1);
     },

+ 4 - 2
src/components/MainPage/Year.vue

@@ -67,7 +67,7 @@ table{
     <thead>
         <tr>
             <th>计划名</th>
-            <th>部门</th>
+            <!-- <th>部门</th> -->
             <!-- <th>参与成员</th> -->
             <th>年份</th>
             <th>简要说明</th>
@@ -77,7 +77,7 @@ table{
     <tbody>
         <tr v-for="(item,index) in planeList" :key="index">
           <td>{{item.name}}</td>
-          <td>{{item.depart}}</td>
+          <!-- <td>{{item.depart}}</td> -->
           <!-- <td>{{item.member}}</td> -->
           <td>{{item.year}}</td>
           <td>{{item.content}}</td>
@@ -188,6 +188,7 @@ export default {
           this.visibleChange = false;
           this.plan = {};
           this.getPlanList();
+          this.$store.dispatch('setCurPlanSin');
         })
       }
       else{
@@ -196,6 +197,7 @@ export default {
           this.visibleChange = false;
           this.plan = {};
           this.getPlanList();
+          this.$store.dispatch('setCurPlanSin');
         })
       }
     },

+ 3 - 0
src/store/actions.js

@@ -3,4 +3,7 @@ export const setLoginUser = ({ commit }, user) => {
 }
 export const setCheckUser = ({ commit }, user) => {
     commit('setCheckUser', user);
+}
+export const setCurPlanSin = ({ commit }) => {
+    commit('setCurPlanSin');
 }

+ 2 - 1
src/store/index.js

@@ -12,7 +12,8 @@ Vue.use(Vuex);
 
 const globalState = {
     loginUser: {},
-    checkUser: {}
+    checkUser: {},
+    curPlanSin: false 
 };
 
 export default new Vuex.Store({

+ 3 - 0
src/store/mutations.js

@@ -10,4 +10,7 @@ export default {
     setCheckUser (state, user) {
         state.checkUser =  user;
     },
+    setCurPlanSin (state) {
+        state.curPlanSin =  !state.curPlanSin;
+    },
 }