HZH-PC\HZH 4 years ago
parent
commit
f59db52865
2 changed files with 34 additions and 12 deletions
  1. 9 0
      src/api/year.js
  2. 25 12
      src/components/MainPage/Year.vue

+ 9 - 0
src/api/year.js

@@ -37,4 +37,13 @@ export function deletePlan(item) {
         url: '/annual/delete',
         data: qs.stringify(item)
     }).then(res => res)
+}
+
+//评价
+export function evaluate(item) {
+    return axios({
+        method: 'post',
+        url: '/annual/evaluate',
+        data: qs.stringify(item)
+    }).then(res => res.data)
 }

+ 25 - 12
src/components/MainPage/Year.vue

@@ -133,7 +133,7 @@ table{
         <span slot="footer" class="dialog-footer">
             <el-button type="primary" @click="noEdit = false;" v-if="noEdit">编辑</el-button>
             <el-button type="primary" @click="visibleJudge = false;plan={}" v-if="!noEdit">取消</el-button>
-            <el-button type="primary" @click="change" v-if="!noEdit">确 定</el-button>
+            <el-button type="primary" @click="change(2)" v-if="!noEdit">确 定</el-button>
         </span>
     </el-dialog>
     <el-dialog
@@ -150,7 +150,7 @@ table{
 </template>
 
 <script>
-import { getPlanList,addPlan,updatePlan,deletePlan } from '@/api/year';
+import { getPlanList,addPlan,updatePlan,deletePlan,evaluate } from '@/api/year';
 import Judge from "@/components/MainPage/Judge/Judge";
 
 export default {
@@ -196,21 +196,34 @@ export default {
       this.plan = JSON.parse(JSON.stringify( item ));
       this.yearData = new Date(item.year,1,1);
     },
-    change(){
+    change(type){
       this.plan.year = this.yearData.getFullYear();
       if(this.plan.id){
-        updatePlan(this.plan).then((result) => {
-          this.$message(result.result?'更新成功':'更新失败');
-          this.visibleChange = false;
-          this.visibleJudge = false;
-          this.plan = {};
-          this.getPlanList();
-          this.$store.dispatch('setCurPlanSin');
-        })
+        if(type == 2){
+          evaluate({
+            id: this.plan.id,
+            evaluation: this.plan.evaluation
+          }).then((result) => {
+            this.$message(result.result?'更新成功':'更新失败');
+            this.visibleJudge = false;
+            this.plan = {};
+            this.getPlanList();
+          })
+        }
+        else{
+          updatePlan(this.plan).then((result) => {
+            this.$message(result.result?'更新成功':'更新失败');
+            this.visibleChange = false;
+            this.visibleJudge = false;
+            this.plan = {};
+            this.getPlanList();
+            this.$store.dispatch('setCurPlanSin');
+          })
+        }
       }
       else{
         addPlan(this.plan).then((result) => {
-          this.$message(result.result?'添加成功':'添加失败');
+          this.$message(result.result?'添加成功':result.message);
           this.visibleChange = false;
           this.plan = {};
           this.getPlanList();