Summer 4 年之前
父節點
當前提交
17d3e598dd
共有 2 個文件被更改,包括 102 次插入112 次删除
  1. 36 46
      src/components/publics/workpoints.vue
  2. 66 66
      src/views/check.vue

+ 36 - 46
src/components/publics/workpoints.vue

@@ -8,7 +8,7 @@
         <!-- <el-tooltip placement="top">
           <div slot="content" class="initia_mark?">多行信息<br/>第二行信息</div>
           <el-button class="initia_el_button"></el-button>
-        </el-tooltip> -->
+        </el-tooltip>-->
         <p class="initia_mark" v-show="v.initia_mark">?</p>
         <el-input v-model="v.initia_input" placeholder="请输入分值"></el-input>
       </div>
@@ -19,38 +19,28 @@
 
 <script>
 export default {
-    props:{
-        'initia_arr':Array,
-        'initia_head':Object
-    },
+  props: {
+    initia_arr: Array,
+    initia_head: Object,
+  },
   data() {
-    return {
-    };
+    return {};
   },
   created() {},
-  mounted() {
-  },
+  mounted() {},
   methods: {
-	save(){
-        let arr = [];
-        for(var i=0;i<this.initia_arr.length;i++){
-            if(this.initia_arr[i].initia_input!==""){
-              arr.push({
-                "sj":this.initia_arr[i].initia_input
-              })
-              this.initia_arr[i].initia_input="";
+    save() {
+      let arr = [];
+      for (var i = 0; i < this.initia_arr.length; i++) {
+        if (this.initia_arr[i].initia_input !== "") {
+          arr.push({
+            sj: this.initia_arr[i].initia_input,
+          });
+          this.initia_arr[i].initia_input = "";
         }
-        }
-        this.$emit('initia',arr);
-
-        // for(var i=0;i<this.initia_arr.length;i++){
-        //     if(this.initia_arr[i].initia_input!==""){
-        //       this.$emit('initia',this.initia_arr[i].initia_input);
-        //       this.initia_arr[i].initia_input="";
-        //     }
-        // }
-        // this.$emit('initia',this.initia_arr[0].initia_input)
-	}
+      }
+      this.$emit("initia", arr);
+    },
   },
 };
 </script>
@@ -59,7 +49,7 @@ export default {
 .initialPoint {
   margin-left: 30px;
 }
-.initia_mark{
+.initia_mark {
   background: #c0c4cc;
   border-radius: 50%;
   width: 14px;
@@ -69,11 +59,11 @@ export default {
   font-size: 12px;
   line-height: 14px;
   text-align: center;
-  margin-left:4px;
+  margin-left: 4px;
 }
 .initia_title {
   font-size: 20px;
-    color: rgba(48, 49, 51, 1);
+  color: rgba(48, 49, 51, 1);
   padding-top: 30px;
   font-family: PingFangSC-Regular;
 }
@@ -82,25 +72,25 @@ export default {
   font-size: 14px;
   margin-top: 10px;
 }
-.nitia_list{
+.nitia_list {
   height: 40px;
   margin-top: 20px;
   display: flex;
   align-items: center;
 }
-.nitia_list span{
-	color:#606266;
-	font-size: 14px;
-    height: 20px;
-    white-space: nowrap;
+.nitia_list span {
+  color: #606266;
+  font-size: 14px;
+  height: 20px;
+  white-space: nowrap;
 }
-.nitia_list input{
-	width: 160px;
-	height: 40px;
-	border-radius: 4px;
-	background-color: rgba(255, 255, 255, 1);
-    border: 1px solid rgba(220, 223, 230, 1);
-    margin-left: 11px;
+.nitia_list input {
+  width: 160px;
+  height: 40px;
+  border-radius: 4px;
+  background-color: rgba(255, 255, 255, 1);
+  border: 1px solid rgba(220, 223, 230, 1);
+  margin-left: 11px;
 }
 
 .initia_button {
@@ -113,9 +103,9 @@ export default {
   text-align: center;
   line-height: 40px;
   margin: 20px 0 0 72px;
-  outline:none;
+  outline: none;
 }
-.initia_el_button{
+.initia_el_button {
   width: 13px;
   border-radius: 50%;
 }

+ 66 - 66
src/views/check.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="all">
-    <workpoints :initia_arr="initia_arr" :initia_head="initia_head" :obj="obj"  @initia="initia"/>
+    <workpoints :initia_arr="initia_arr" :initia_head="initia_head" :obj="obj" @initia="initia" />
   </div>
 </template>
 
@@ -14,26 +14,58 @@ export default {
         initial_suertext: "以下考勤奖扣分,均为B分",
       },
       initia_arr: [
-        { initialName: "月度全勤,每月加分", initia_mark: false, initia_input: "" },
-        { initialName: "正常打卡,每次加分", initia_mark: false, initia_input: "" },
-        { initialName: "上下班缺卡,每次扣分", initia_mark: false, initia_input: "" },
-        { initialName: "上班迟到,每次扣分", initia_mark: false, initia_input: "" },
+        {
+          initialName: "月度全勤,每月加分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "正常打卡,每次加分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "上下班缺卡,每次扣分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "上班迟到,每次扣分",
+          initia_mark: false,
+          initia_input: "",
+        },
         // { initialName: "严重迟到,每次扣分", initia_mark: false, initia_input: "" },
-        { initialName: "下班早退,每次扣分", initia_mark: false, initia_input: "" },
-        { initialName: "矿工缺席,每次扣分", initia_mark: false, initia_input: "" },
-        { initialName: "加班,每小时加分", initia_mark: false, initia_input: "" },
-        { initialName: "请假,每小时扣分", initia_mark: false, initia_input: "" },
+        {
+          initialName: "下班早退,每次扣分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "矿工缺席,每次扣分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "加班,每小时加分",
+          initia_mark: false,
+          initia_input: "",
+        },
+        {
+          initialName: "请假,每小时扣分",
+          initia_mark: false,
+          initia_input: "",
+        },
       ],
-      obj:{
-        month_full_ad:"",
-        normal:"",
-        no_sign:"",
-        absent:"",
-        on_duty_late:"",
-        off_duty_early:"",
-        ot_per_hour:"",
-        leave_per_hour:"",
-      }
+      obj: {
+        month_full_ad: "", //>=0
+        normal: "", //>=0
+        no_sign: "", //<=0
+        absent: "", //<=0
+        on_duty_late: "", //<=0
+        off_duty_early: "", //<=0
+        ot_per_hour: "", //>=0
+        leave_per_hour: "", //<=0
+      },
     };
   },
   components: {
@@ -42,54 +74,22 @@ export default {
   created() {},
   mounted() {},
   methods: {
-	  initia(ok){
-      let objs = this.obj
-      objs.month_full_ad = ok[0].sj
-      objs.normal = ok[1].sj
-      objs.no_sign = ok[2].sj
-      objs.absent = ok[5].sj
-      objs.on_duty_late = ok[3].sj
-      objs.off_duty_early = ok[4].sj
-      objs.ot_per_hour = ok[6].sj
-      objs.leave_per_hour = ok[7].sj
-      // console.log(objs)
-
-      this.$axios.post('api/ad/update', this.obj).then(res => {
-         console.log(res)
-      })
-      // let objToStr = JSON.stringify(this.obj)
-      // console.log(objToStr)
-      // this.$axios({
-      //   url: 'api/ad/update',
-      //   method:'post',
-      //   data:this.obj,
-      //   headers: {"Content-Type": "application/x-www-form-urlencoded","J-TOKEN":" eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvdGVzdC1kaW5nLmcxMDcuY29tXC9hcGlcL2RpbmdcL2xvZ2luIiwiaWF0IjoxNTk3NDc5OTgxLCJleHAiOjE1OTgwNzk5ODEsIm5iZiI6MTU5NzQ3OTk4MSwianRpIjoiVnpYeUQwRW82dU1VWFJNVSIsInN1YiI6MiwicHJ2IjoiY2E2NDg5ZDUwZjI0MDdhNjc4MzBlODA5MGQwMTQ4ODM1Njg1OTYyYiIsInJvbGUiOiJlbXBsb3llZSJ9.mfpDxWCOwNYevccHWwYu2nHc6FRjyz-2RjCbEflMXiY" },
-        
-      // }).then((ok)=>{
-      //   console.log(ok)
-      // })
-
-      
-
-      // this.$axios.post('api/ad/update', {
-      //   month_full_ad : ok[0].sj,
-      //   normal : ok[1].sj,
-      //   no_sign : ok[2].sj,
-      //   absent : ok[3].sj,
-      //   on_duty_late : ok[4].sj,
-      //   off_duty_early : ok[5].sj,
-      //   ot_per_hour : ok[6].sj,
-      //   leave_per_hour : ok[7].sj,
-      // }).then(res => {
-      //    console.log(res)
-      // });
-      // console.log(ok[0].sj)
-
-      // console.log(ok)
+    initia(ok) {
+      // 待优化:
+      let objs = this.obj;
+      objs.month_full_ad = ok[0].sj;
+      objs.normal = ok[1].sj;
+      objs.no_sign = ok[2].sj;
+      objs.absent = ok[5].sj;
+      objs.on_duty_late = ok[3].sj;
+      objs.off_duty_early = ok[4].sj;
+      objs.ot_per_hour = ok[6].sj;
+      objs.leave_per_hour = ok[7].sj;
 
-      // this.month_full_ad = ok[0]
-		 
-	  }
+      this.$axios.post("api/ad/update", this.obj).then((res) => {
+        console.log(res);
+      });
+    },
   },
 };
 </script>