|
@@ -0,0 +1,1192 @@
|
|
|
|
+<template>
|
|
|
|
+ <view class="page-box">
|
|
|
|
+ <view class="head-box">
|
|
|
|
+ <uni-nav-bar id="header_nav" left-icon="arrowleft" type="line" title="日评打分" @clickLeft="back" />
|
|
|
|
+ </view>
|
|
|
|
+ <form @submit="formsubmit">
|
|
|
|
+ <view class="content-box">
|
|
|
|
+ <view>
|
|
|
|
+ <view class="pa_row pa-sb h-mid bg_whilecolor mb-1 a-center border-bottom mx-1" >
|
|
|
|
+ <view class="mx-1">
|
|
|
|
+ <label class="mark_color font-weight">*</label>
|
|
|
|
+ <label class="font-weight">针对员工</label>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="pa_row w-30">
|
|
|
|
+ <uniRightCombox class="w-100 m-0 p-0" ref="logtype" :candidates="employees" :value="employee.name" @update:modelValue="onEmplyeeClick"></uniRightCombox>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <!--<label class="pr-1 font-weight" @click="toggleSelector">{{employee.name}}<uni-icons color="#C8C8C8" type="arrowright"/></label> -->
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ <view class="pa_row pa-sb h-mid bg_whilecolor mx-1 a-center" >
|
|
|
|
+ <view class="mx-1">
|
|
|
|
+ <label class="mark_color font-weight">*</label>
|
|
|
|
+ <label class="font-weight">针对日期</label>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="pa_row">
|
|
|
|
+ <label class="pr-1 font-weight" @click="open">{{dateweek}}<uni-icons color="#C8C8C8" type="arrowright"/></label>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="pt-1 border-top-10" v-for="(item,index) in projects" :key="index">
|
|
|
|
+ <view>
|
|
|
|
+ <label class="pl-1 font-weight font_sm">{{item.name}}
|
|
|
|
+ <label v-show="item.score>0">:{{item.score}}分</label></label>
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ <view class="px-1" v-show="item.type==2">
|
|
|
|
+ <view class="pa_column pb-1" :class="{border_bottom_1:index1<(item.items.length-1)}" v-for="(item1,index1) in item.items" :key="index1">
|
|
|
|
+ <view class="pa_row pa-sb">
|
|
|
|
+
|
|
|
|
+ <label class="radio a-center j-center ">
|
|
|
|
+ {{item1.text}}({{item1.unit}})
|
|
|
|
+ </label>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="pa_row pa-sb" >
|
|
|
|
+ <slider-number :ref="item1.id" :name="item1.text" :id="item1.id" :min="item1.slider_min" :max="item1.slider_max" :step="item1.slider_step" v-model="item1.value" @onChange="calc_score"></slider-number>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="px-1" v-show="item.type==1">
|
|
|
|
+ <!-- <radio-group @change="changed"> -->
|
|
|
|
+ <view class="pa_column pb-1 " :class="{border_bottom_1:index1<(item.items.length-1)}" v-for="(item1,index1) in item.items" :key="index1">
|
|
|
|
+ <view class="pa_row pa-sb">
|
|
|
|
+ <view class="w-85">
|
|
|
|
+ <view class="h-100 pa_column j-center">
|
|
|
|
+ <label class="radio a-center j-center " >
|
|
|
|
+ {{item1.text}}{{item1.unit}}
|
|
|
|
+<!-- <radio :value="item1.id.toString()" :checked="item.selectedIndex == item1.id" @click="_group_clicked(item1.id)" />{{item1.text}}-->
|
|
|
|
+ </label>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="w-15">
|
|
|
|
+ <input type="number" :id="item1.id" class="uni-input bg-grey my-1 rounded-10" @input="onKeyInput" v-model="item1.value"
|
|
|
|
+ :class="{textred:item1.value<0,
|
|
|
|
+ textgrey:item1.value>=0}"/>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <!--</radio-group>-->
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ <view class="footer-box">
|
|
|
|
+ <view class="pa_row a-center h-100">
|
|
|
|
+ <view class="w-50">
|
|
|
|
+ <label class="font-sm lh_footer mx-2" >得分:</label>
|
|
|
|
+ <label class="font-sm lh_footer">{{score.toFixed(2)}}</label>
|
|
|
|
+ </view>
|
|
|
|
+ <button form-type="submit" class="w-50 btn_bgcolor btn_color">提交</button>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </form>
|
|
|
|
+ <uni-calendar ref="calendar" @change="change" class="uni-calendar--hook" :clear-date="true" :date="info.date" :insert="info.insert" :lunar="info.lunar" :startDate="info.startDate" :endDate="info.endDate" :range="info.range" @confirm="confirm" @close="close" />
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import utils from '../../utils/common.js'
|
|
|
|
+ import store from '../../utils/store.js'
|
|
|
|
+
|
|
|
|
+ import RenCalendar from '@/components/ren-calendar/ren-calendar.vue'
|
|
|
|
+ import uniRightCombox from '@/components/uni-right-combox/uni-right-combox.vue'
|
|
|
|
+ import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue'
|
|
|
|
+ import sliderNumber from '@/components/slider-number/slider-number.vue'
|
|
|
|
+ var _self;
|
|
|
|
+ export default {
|
|
|
|
+ components:{
|
|
|
|
+ RenCalendar,
|
|
|
|
+ uniRightCombox,
|
|
|
|
+ uniNumberBox,
|
|
|
|
+ sliderNumber
|
|
|
|
+ },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ showSelector:false,
|
|
|
|
+
|
|
|
|
+ kpi_url:'',
|
|
|
|
+ template:'',
|
|
|
|
+ calendar:'',
|
|
|
|
+ workNums:0,
|
|
|
|
+ score:0,
|
|
|
|
+ info: {
|
|
|
|
+ lunar: true,
|
|
|
|
+ range: true,
|
|
|
|
+ insert: false,
|
|
|
|
+ date:utils.get_date_str(new Date()),
|
|
|
|
+ startDate:utils.get_date_str(utils.addMonth(new Date(),-1)),
|
|
|
|
+ endDate:utils.get_date_str(utils.addMonth(new Date(),1)),
|
|
|
|
+ selected: []
|
|
|
|
+ },
|
|
|
|
+ level:0,
|
|
|
|
+ submit_projects:[],
|
|
|
|
+ projects:[
|
|
|
|
+ ],
|
|
|
|
+ dtl:[
|
|
|
|
+ ],
|
|
|
|
+ employee:{id:'0',name:'李广宵'},
|
|
|
|
+ employees:[{id:'1',value:'zhupeng'},
|
|
|
|
+ {id:'2',value:'zhupeng2'},
|
|
|
|
+ {id:'3',value:'zhupeng3'},
|
|
|
|
+ {id:'4',value:'zhupeng4'},
|
|
|
|
+ {id:'5',value:'zhupeng5'}],
|
|
|
|
+ year:new Date().getFullYear(),
|
|
|
|
+ month:new Date().getMonth()+1,
|
|
|
|
+ day:new Date().getDate()
|
|
|
|
+ //dateweek:'2021-10-01 星期一'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ onLoad()
|
|
|
|
+ {
|
|
|
|
+ _self = this;
|
|
|
|
+
|
|
|
|
+ //console.log('xxx'+this.info.date);
|
|
|
|
+
|
|
|
|
+ //console.log('kpi_url'+this.kpi_url)
|
|
|
|
+ this.kpi_url= uni.getStorageSync('kpi-url');
|
|
|
|
+ this.employeeID = uni.getStorageSync('usId');
|
|
|
|
+ if(!this.employeeID || this.employeeID.length<=0)
|
|
|
|
+ {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '未设置员工ID',
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.refreshEmployeeList();
|
|
|
|
+
|
|
|
|
+ _self.onActivate();
|
|
|
|
+ return;
|
|
|
|
+ console.log("onLoad");
|
|
|
|
+
|
|
|
|
+ let date = new Date();
|
|
|
|
+ this.year = date.getFullYear();
|
|
|
|
+ this.month = date.getMonth()+1;
|
|
|
|
+ this.day = date.getDate();
|
|
|
|
+
|
|
|
|
+ this.settingDate(this.year,this.month,this.day);
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ activated()
|
|
|
|
+ {
|
|
|
|
+ _self.onActivate();
|
|
|
|
+ },
|
|
|
|
+ onReady()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ //this.LoadKpiTemplate(this.employeeID);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ computed: {
|
|
|
|
+ // 顶部星期栏
|
|
|
|
+ dateweek() {
|
|
|
|
+ let str = utils.get_date_week_str(new Date(this.year,this.month-1,this.day));
|
|
|
|
+ //console.log('xxxxxxxxxx'+str);
|
|
|
|
+ return str;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods:
|
|
|
|
+ {
|
|
|
|
+ onActivate()
|
|
|
|
+ {
|
|
|
|
+ // #ifdef APP-NVUE
|
|
|
|
+ const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
|
|
|
|
+ // #endif
|
|
|
|
+ // #ifndef APP-NVUE
|
|
|
|
+ const eventChannel = this.getOpenerEventChannel();
|
|
|
|
+ // #endif
|
|
|
|
+ eventChannel.on('acceptDataFromOpenerPage', function(data) {
|
|
|
|
+ if(data)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ let param = data.data;
|
|
|
|
+ if(param)
|
|
|
|
+ {
|
|
|
|
+ //console.log('month score activated'+JSON.stringify(data));
|
|
|
|
+ //return;
|
|
|
|
+ if(param.action && param.action=='employee_daily_report')
|
|
|
|
+ {
|
|
|
|
+ if(param.month)
|
|
|
|
+ {
|
|
|
|
+ let year = Number(param.month.substr(0,4));
|
|
|
|
+ let month = Number(param.month.substr(5,2));
|
|
|
|
+ _self.year = year;
|
|
|
|
+ _self.month = month;
|
|
|
|
+ _self.day = 1;
|
|
|
|
+ _self.info.startDate = utils.get_date_str(utils.addMonth(new Date(year,month-1,1),-1));
|
|
|
|
+ _self.info.date = utils.get_date_str(new Date(year,month-1,1));
|
|
|
|
+ _self.info.endDate= utils.get_date_str(utils.addMonth(new Date(year,month-1,1),1));
|
|
|
|
+ //console.log('year'+_self.year+'month'+_self.month);
|
|
|
|
+ }
|
|
|
|
+ if(param.employee)
|
|
|
|
+ {
|
|
|
|
+ _self.employee = param.employee;//{id:param.,name:'李广宵'},
|
|
|
|
+ _self.LoadKpiTemplate(_self.employee.id,_self.employeeID);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else if(param.action && param.action=='daily_report_detail')
|
|
|
|
+ {
|
|
|
|
+ //{"data":{"action":"daily_report_detail","year":"2021","month":"09","day":"30","id":102,"name":"徐邱"}}
|
|
|
|
+ //return;
|
|
|
|
+ //console.log("param " + JSON.stringify(param))
|
|
|
|
+ if(param.year && param.month && param.day)
|
|
|
|
+ {
|
|
|
|
+ //let year = Number(param.month.substr(0,4));
|
|
|
|
+ //let month = Number(param.month.substr(5,2));
|
|
|
|
+ _self.year = Number(param.year);
|
|
|
|
+ _self.month = Number(param.month);
|
|
|
|
+ _self.day = Number(param.day);
|
|
|
|
+ _self.info.startDate = utils.get_date_str(utils.addMonth(new Date(_self.year,_self.month-1,1),-1));
|
|
|
|
+ _self.info.date = utils.get_date_str(new Date(_self.year,_self.month-1,_self.day));
|
|
|
|
+ _self.info.endDate= utils.get_date_str(utils.addMonth(new Date(_self.year,_self.month-1,1),1));
|
|
|
|
+ //console.log('time year'+_self.year+'month'+_self.month+'day'+_self.day);
|
|
|
|
+ }
|
|
|
|
+ if(param.id && param.name)
|
|
|
|
+ {
|
|
|
|
+ _self.employee = {id:param.id,name:param.name},
|
|
|
|
+ //console.log('kpi date'+_self.info.date)
|
|
|
|
+ _self.LoadKpiTemplate(_self.employee.id,_self.employeeID);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ onEmplyeeClick(data)
|
|
|
|
+ {
|
|
|
|
+ if(data.id && data.value)
|
|
|
|
+ {
|
|
|
|
+ this.employee = {id:data.id,name:data.value};
|
|
|
|
+ this.LoadKpiTemplate(this.employee.id,this.employeeID);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //console.log('data'+JSON.stringify(data));
|
|
|
|
+ },
|
|
|
|
+ onKeyInput: function(event) {
|
|
|
|
+ //console.log('input id'+ event.target.value);
|
|
|
|
+ //this.inputValue = event.target.value
|
|
|
|
+ //console.log('input id ' + event.target.id);
|
|
|
|
+ let itemIndex = this.findDtlById(event.target.id);
|
|
|
|
+ if(itemIndex>=0)
|
|
|
|
+ {
|
|
|
|
+ let projectIndex = this.findProjectById(this.dtl[itemIndex].fid);
|
|
|
|
+ if(projectIndex>=0)
|
|
|
|
+ {
|
|
|
|
+ for(let i = 0;i< this.projects[projectIndex].items.length;i++)
|
|
|
|
+ {
|
|
|
|
+ if(this.projects[projectIndex].items[i].id == event.target.id)
|
|
|
|
+ {
|
|
|
|
+ //console.log('单位最大值'+ this.projects[projectIndex].items[i].unitvalue);
|
|
|
|
+ let maxvalue = this.projects[projectIndex].items[i].multiple;
|
|
|
|
+ if(maxvalue>0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('xxxx')
|
|
|
|
+ if(Number(event.target.value) >maxvalue){
|
|
|
|
+ this.projects[projectIndex].items[i].value = this.workNums;
|
|
|
|
+ //console.log('11xxxx' + this.projects[projectIndex].items[i].value)
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if(Number(event.target.value) < 0){
|
|
|
|
+ this.projects[projectIndex].items[i].value = 0;
|
|
|
|
+ //console.log('22xxxx')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.calc_score();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ open() {
|
|
|
|
+ this.$refs.calendar.open()
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ findDtlByName(projectIndex,name)
|
|
|
|
+ {
|
|
|
|
+ if(projectIndex>=this.projects.length)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ for(let i = 0;i<this.projects[projectIndex].items.length;i++)
|
|
|
|
+ {
|
|
|
|
+ if(this.projects[projectIndex].items[i].text == name)
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ },
|
|
|
|
+ findProjectByName(name)
|
|
|
|
+ {
|
|
|
|
+ for(let i = 0;i<this.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ if(this.projects[i].name == name)
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ },
|
|
|
|
+ findDtlById(id)
|
|
|
|
+ {
|
|
|
|
+ for(let i = 0;i<this.dtl.length;i++)
|
|
|
|
+ {
|
|
|
|
+ if(this.dtl[i].id == id)
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ },
|
|
|
|
+ findProjectById(id)
|
|
|
|
+ {
|
|
|
|
+ for(let i = 0;i<this.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ if(this.projects[i].id == id)
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ },
|
|
|
|
+ clicked:function(_id)
|
|
|
|
+ {
|
|
|
|
+ //console.log('clicked' +_id)
|
|
|
|
+ let itemIndex = this.findDtlById(_id);
|
|
|
|
+ if(itemIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find dtl index '+_id);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let projectIndex = this.findProjectById(this.dtl[itemIndex].fid);
|
|
|
|
+ if(projectIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find project index '+this.dtl[itemIndex].fid);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //console.log('log Index : '+itemIndex +'project Index: ' +projectIndex)
|
|
|
|
+ //return;
|
|
|
|
+ for (let i = 0; i < this.projects[projectIndex].items.length; i++) {
|
|
|
|
+ //console.log('id:'+this.projects[projectIndex].items[i].id);
|
|
|
|
+ if (this.projects[projectIndex].items[i].id === _id) {
|
|
|
|
+ //console.log('find item'+ _id)
|
|
|
|
+ this.projects[projectIndex].items[i].checked = !this.projects[projectIndex].items[i].checked;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.calc_score();
|
|
|
|
+ },
|
|
|
|
+ _group_clicked:function(_id)
|
|
|
|
+ {
|
|
|
|
+ //console.log('_group_clicked ' +_id )
|
|
|
|
+ let itemIndex = this.findDtlById(_id);
|
|
|
|
+ if(itemIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find dtl index '+_id);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let projectIndex = this.findProjectById(this.dtl[itemIndex].fid);
|
|
|
|
+ if(projectIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find project index '+this.dtl[itemIndex].fid);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //console.log('selectedIndex : '+this.projects[projectIndex].selectedIndex )
|
|
|
|
+ //return;
|
|
|
|
+ if(this.projects[projectIndex].selectedIndex== _id)
|
|
|
|
+ {
|
|
|
|
+ for (let i = 0; i < this.projects[projectIndex].items.length; i++) {
|
|
|
|
+ //console.log('id:'+this.projects[projectIndex].items[i].id);
|
|
|
|
+ if (this.projects[projectIndex].items[i].id == _id) {
|
|
|
|
+ //console.log('find item'+ _id)
|
|
|
|
+ if(this.projects[projectIndex].selectedIndex == _id)
|
|
|
|
+ {
|
|
|
|
+ console.log('unselected:'+_id);
|
|
|
|
+ this.projects[projectIndex].selectedIndex = -1;
|
|
|
|
+ }
|
|
|
|
+ this.projects[projectIndex].items[i].checked = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ for (let i = 0; i < this.projects[projectIndex].items.length; i++) {
|
|
|
|
+ //console.log('id:'+this.projects[projectIndex].items[i].id);
|
|
|
|
+ if (this.projects[projectIndex].items[i].id == _id) {
|
|
|
|
+ this.projects[projectIndex].selectedIndex = _id;
|
|
|
|
+ this.projects[projectIndex].items[i].checked = true;
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ //this.projects[projectIndex].selectedIndex = -1;
|
|
|
|
+ this.projects[projectIndex].items[i].checked = false;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ this.calc_score();
|
|
|
|
+ },
|
|
|
|
+ changed:function(evt)
|
|
|
|
+ {
|
|
|
|
+ //console.log('changed' +evt.detail.value)
|
|
|
|
+ let itemIndex = this.findDtlById(evt.detail.value);
|
|
|
|
+ if(itemIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find dtl index '+evt.detail.value);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let projectIndex = this.findProjectById(this.dtl[itemIndex].fid);
|
|
|
|
+ if(projectIndex<0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find project index '+this.dtl[itemIndex].fid);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //console.log('log Index : '+itemIndex +'project Index: ' +projectIndex + )
|
|
|
|
+ //return;
|
|
|
|
+ for (let i = 0; i < this.projects[projectIndex].items.length; i++) {
|
|
|
|
+ //console.log('id:'+this.projects[projectIndex].items[i].id);
|
|
|
|
+ if (this.projects[projectIndex].items[i].id.toString() === evt.detail.value) {
|
|
|
|
+ //console.log('find item'+ evt.detail.value)
|
|
|
|
+ if(!this.projects[projectIndex].items[i].checked)
|
|
|
|
+ {
|
|
|
|
+ this.projects[projectIndex].selectedIndex = evt.detail.value;
|
|
|
|
+ this.projects[projectIndex].items[i].checked = true;
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ this.projects[projectIndex].selectedIndex = -1;
|
|
|
|
+ this.projects[projectIndex].items[i].checked = false;
|
|
|
|
+ }
|
|
|
|
+ //this.projects[projectIndex].items[i].checked = !this.projects[projectIndex].items[i].checked;
|
|
|
|
+ //break;
|
|
|
|
+ }else{
|
|
|
|
+ this.projects[projectIndex].items[i].checked = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /*updateUnitValue()
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ if(this.projects)
|
|
|
|
+ {
|
|
|
|
+ for(let index = 0;index<this.projects.length;index++)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ for(let index1 = 0;index1<this.projects[index].items.length;index1++)
|
|
|
|
+ {
|
|
|
|
+ let text = this.projects[index].items[index1].text;
|
|
|
|
+
|
|
|
|
+ if(this.projects[index].name =='工作量')
|
|
|
|
+ {
|
|
|
|
+ if(text.indexOf('工作量分')>=0)
|
|
|
|
+ {
|
|
|
|
+ console.log('jjj' + JSON.stringify(this.projects[index].items[index1]))
|
|
|
|
+ let score = this.projects[index].score/this.workNums;
|
|
|
|
+ this.projects[index].items[index1].score = score.toFixed(1);
|
|
|
|
+ this.projects[index].items[index1].unit = '天'
|
|
|
|
+ //this.projects[index].items[index1].unit = score;
|
|
|
|
+ this.projects[index].items[index1].memo = this.workNums +'个工作日 ' + score.toFixed(2) + '分/天';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.projects[index].name =='工作质量')
|
|
|
|
+ {
|
|
|
|
+ if(text.indexOf('质量分')>=0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('yyyy')
|
|
|
|
+ let score = this.projects[index].score/this.workNums;
|
|
|
|
+ this.projects[index].items[index1].score = score.toFixed(1);
|
|
|
|
+ this.projects[index].items[index1].unit = '天'
|
|
|
|
+ //this.projects[index].items[index1].unit = score;
|
|
|
|
+ this.projects[index].items[index1].memo = this.workNums +'个工作日 ' + score.toFixed(2) + '分/天';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(this.projects[index].name =='工作态度')
|
|
|
|
+ {
|
|
|
|
+ if(text.indexOf('态度分')>=0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('yyyy')
|
|
|
|
+ let score = this.projects[index].score/this.workNums;
|
|
|
|
+ this.projects[index].items[index1].score = score.toFixed(1);
|
|
|
|
+ this.projects[index].items[index1].unit = '天'
|
|
|
|
+ //this.projects[index].items[index1].unit = score;
|
|
|
|
+ this.projects[index].items[index1].memo = this.workNums +'个工作日 ' + score.toFixed(2) + '分/天';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //console.log('zzz')
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ LoadWorkLog(_year,_month)
|
|
|
|
+ {
|
|
|
|
+ _self.updateUnitValue();
|
|
|
|
+ return;
|
|
|
|
+ let workMonth = 'WorkDays_' +_year.toString() +'-' + utils.formatNum(_month);
|
|
|
|
+ let workDays = uni.getStorageSync(workMonth);
|
|
|
|
+ if(workDays)
|
|
|
|
+ {
|
|
|
|
+ _self.workNums = workDays;
|
|
|
|
+ _self.updateUnitValue();
|
|
|
|
+ console.log('读取工作天数:'+workMonth + ':'+workDays);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ uni.request({
|
|
|
|
+ url: 'https://xpgjapi.xiaoxinda.com/mobile/workAttendance/queryMonthWorkDays',//'http://192.168.77.99:8080/api/loadMonthWorkSummary.do',//?workNum='+this.employeeNumber+'&workMonth='+this.workMonth, //仅为示例,并非真实接口地址。
|
|
|
|
+ data:{year:_year,month:_month},
|
|
|
|
+ method:'POST',
|
|
|
|
+ timeout:20000,
|
|
|
|
+ header: {
|
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
|
|
|
|
+ },
|
|
|
|
+ success: (res) => {
|
|
|
|
+
|
|
|
|
+ if(res.statusCode==200)
|
|
|
|
+ {
|
|
|
|
+ if(res.data)
|
|
|
|
+ {
|
|
|
|
+ _self.workNums = res.data;
|
|
|
|
+ uni.setStorageSync(workMonth,_self.workNums);
|
|
|
|
+ //console.log('result:' +JSON.stringify(res));
|
|
|
|
+ _self.updateUnitValue();
|
|
|
|
+ console.log('读取工作天数【'+workMonth + ':'+JSON.data(_self.workNums));
|
|
|
|
+ //console.log('res'+this.workNums);
|
|
|
|
+ return ;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=>{
|
|
|
|
+ console.log('LoadWorkLog requrest failed')
|
|
|
|
+ console.log(res);
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:'请求工作天数失败,请检查网络!',
|
|
|
|
+ showCancel:false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ complete:()=>{
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },*/
|
|
|
|
+ sortByIndex(index,name)
|
|
|
|
+ {
|
|
|
|
+ let destIndex = index;
|
|
|
|
+ for(;index < this.projects.length;index++)
|
|
|
|
+ {
|
|
|
|
+ if(this.projects[index].name==name)
|
|
|
|
+ {
|
|
|
|
+ let temp = this.projects[index];
|
|
|
|
+ this.projects[index] = this.projects[destIndex];
|
|
|
|
+ this.projects[destIndex] = temp;
|
|
|
|
+ return destIndex;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ },
|
|
|
|
+ filter_item(item)
|
|
|
|
+ {
|
|
|
|
+ let _item = Object.assign({},item);
|
|
|
|
+ _item.items = [];
|
|
|
|
+ //let _item = {fid:item.fid,is_month_assess:item.is_month_assess,score:item.score,del_flag:item.del_flag,name:item.name,is_day_assess:item.is_day_assess,id:item.id,type:item.type,is_multiple:item.is_multiple,items:[]};
|
|
|
|
+ for(let j=0;j<item.items.length;j++)
|
|
|
|
+ {
|
|
|
|
+ if(item.items[j].is_day_assess)
|
|
|
|
+ {
|
|
|
|
+ _item.items.push(item.items[j]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //console.log('item'+JSON.stringify(_item));
|
|
|
|
+ return _item;
|
|
|
|
+ },
|
|
|
|
+ LoadKpiTemplate(_usId,_evalUsId)
|
|
|
|
+ {
|
|
|
|
+ //console.log('读取考勤模板usId ' + _usId + ' evalUsId '+_evalUsId+'assessMonth'+this.info.date)
|
|
|
|
+
|
|
|
|
+ uni.request({
|
|
|
|
+ url: this.kpi_url+ '/api/loadDayAssessTemplate.do',//'http://192.168.77.99:8080/api/loadMonthWorkSummary.do',//?workNum='+this.employeeNumber+'&workMonth='+this.workMonth, //仅为示例,并非真实接口地址。
|
|
|
|
+ data:{usId:_usId,evalUsId:_evalUsId,assessMonth:this.info.date},
|
|
|
|
+ method:'GET',
|
|
|
|
+ timeout:20000,
|
|
|
|
+ /*header: {
|
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded' //自定义请求头信息
|
|
|
|
+ },*/
|
|
|
|
+ success: (res) => {
|
|
|
|
+ //console.log('xxxres'+JSON.stringify(res.data));
|
|
|
|
+
|
|
|
|
+ if(res.data.success){
|
|
|
|
+
|
|
|
|
+ if(res.data.data)
|
|
|
|
+ {
|
|
|
|
+ if(res.data.data.level)
|
|
|
|
+ {
|
|
|
|
+ _self.level = res.data.data.level;
|
|
|
|
+ //console.log('level'+_self.level);
|
|
|
|
+ }
|
|
|
|
+ if(res.data.data.projects)
|
|
|
|
+ {
|
|
|
|
+ this.projects = [];
|
|
|
|
+ for(let i = 0;i < res.data.data.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ let item = _self.filter_item(res.data.data.projects[i]);
|
|
|
|
+ //let project = {fid:item.fid,id:item.id,name:item.name,type:item.type,selectedIndex:-1,score:item.score,checked:false,value:0,text:'',items:[]};
|
|
|
|
+ if(item.items.length>0)
|
|
|
|
+ _self.projects.push(item);
|
|
|
|
+ //console.log('item'+JSON.stringify(item));
|
|
|
|
+ }
|
|
|
|
+ let destIndex = -1;
|
|
|
|
+ destIndex = _self.sortByIndex(destIndex+1,'工作量');
|
|
|
|
+ destIndex = _self.sortByIndex(destIndex+1,'工作质量');
|
|
|
|
+ destIndex = _self.sortByIndex(destIndex+1,'工作态度');
|
|
|
|
+ destIndex = _self.sortByIndex(destIndex+1,'出勤情况');
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ _self.refreshDayAssess(_self.year,_self.month,_self.day);
|
|
|
|
+ }
|
|
|
|
+ /**this.work_logs = res.data.data;
|
|
|
|
+
|
|
|
|
+ if(this.work_logs)
|
|
|
|
+ {
|
|
|
|
+// console.log('xxxxx'+JSON.stringify(this.work_logs));
|
|
|
|
+ for(let i = 0;i< this.work_logs.length;i++)
|
|
|
|
+ {
|
|
|
|
+ //console.log('i'+i+JSON.stringify(this.work_logs[i]));
|
|
|
|
+ if(this.work_logs[i].summaryLen>0)
|
|
|
|
+ this.$refs.ren.set_status_by_datestr1(this.work_logs[i].workDate,1);
|
|
|
|
+ else
|
|
|
|
+ this.$refs.ren.set_status_by_datestr1(this.work_logs[i].workDate,3);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ /*console.log('fail')
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.exception,
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });*/
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=>{
|
|
|
|
+ /*console.log('requrest failed')
|
|
|
|
+ console.log(res);
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:'请求服务失败,请检查网络!',
|
|
|
|
+ showCancel:false
|
|
|
|
+ })*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ complete:()=>{
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ settingDate(_year,_month,_day)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ let date = new Date(_year,_month-1,_day);
|
|
|
|
+ let nextMonth = utils.addMonth(date,1);
|
|
|
|
+ let previousMonth = utils.addMonth(date,-1);
|
|
|
|
+
|
|
|
|
+ this.info.date = date.getFullYear().toString()+'-'+utils.formatNum(date.getMonth()+1)+'-'+ utils.formatNum(date.getDate());
|
|
|
|
+ this.info.startDate = previousMonth.getFullYear().toString()+'-'+utils.formatNum(previousMonth.getMonth()+1)+'-'+ utils.formatNum(previousMonth.getDate());
|
|
|
|
+ this.info.endDate = nextMonth.getFullYear().toString()+'-'+utils.formatNum(nextMonth.getMonth()+1)+'-'+ utils.formatNum(nextMonth.getDate());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //this.info.date = _year + '-' + utils.formatNum(_month)+ utils.formatNum(_day);
|
|
|
|
+ //
|
|
|
|
+ //let startDate = utils.addMonth(date,1);
|
|
|
|
+ //let endDate = utils.addMonth(date,-1);
|
|
|
|
+ //this.info.startDate = startDate.getFullYear() + '-' + utils.formatNum(startDate.getMonth()+1)+ utils.formatNum(startDate.getDate());
|
|
|
|
+ //this.info.endDate = endDate.getFullYear() + '-' + utils.formatNum(endDate.getMonth()+1)+ utils.formatNum(endDate.getDate());
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ confirm(e) {
|
|
|
|
+ //console.log('xxxxxx'+ e.fulldate);
|
|
|
|
+ //return ;
|
|
|
|
+ let year = e.fulldate.substr(0,4);
|
|
|
|
+ let month = e.fulldate.substr(5,2);
|
|
|
|
+ let day = e.fulldate.substr(8,2);
|
|
|
|
+ this.year = year;
|
|
|
|
+ this.month = month;
|
|
|
|
+ this.day = day;
|
|
|
|
+ this.settingDate(year,month,day);
|
|
|
|
+ this.refreshDayAssess(year,month,day);
|
|
|
|
+ return ;
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ change(e){
|
|
|
|
+ //console.log('change'+e);
|
|
|
|
+ },
|
|
|
|
+ close() {
|
|
|
|
+ //console.log('弹窗关闭');
|
|
|
|
+ },
|
|
|
|
+ back() {
|
|
|
|
+ console.log('test')
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ refreshDayAssess(_year,_month,_day)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ let workMonth = _year.toString()+'-'+utils.formatNum(_month) +'-'+ utils.formatNum(_day);
|
|
|
|
+ //console.log('id:'+this.employee.id);
|
|
|
|
+ //console.log('evaUsrID:'+this.employeeID);
|
|
|
|
+ //console.log('workMonth:'+workMonth);
|
|
|
|
+ let loadMonthAssess = false;
|
|
|
|
+ _self.disabled= false;
|
|
|
|
+ uni.request({
|
|
|
|
+ url: this.kpi_url+ '/api/loadDayAssess.do',//'http://192.168.77.99:8080/api/loadMonthWorkSummary.do',//?workNum='+this.employeeNumber+'&workMonth='+this.workMonth, //仅为示例,并非真实接口地址。
|
|
|
|
+ data:{usId:this.employee.id,evaUsId:this.employeeID,assessMonth:workMonth},
|
|
|
|
+ method:'GET',
|
|
|
|
+ timeout:20000,
|
|
|
|
+
|
|
|
|
+ success: (res) => {
|
|
|
|
+ //console.log('读取月评:'+JSON.stringify(res.data));
|
|
|
|
+ //return;
|
|
|
|
+
|
|
|
|
+ if(res.data.success){
|
|
|
|
+
|
|
|
|
+ //console.log('dddd'+JSON.stringify(res))
|
|
|
|
+ if(res.data.data)
|
|
|
|
+ {
|
|
|
|
+ if(res.data.data.list)
|
|
|
|
+ {
|
|
|
|
+ let items = res.data.data.list;
|
|
|
|
+
|
|
|
|
+ for(let i = 0;i< items.length;i++)
|
|
|
|
+ {
|
|
|
|
+ let index = _self.findProjectByName(items[i].title);
|
|
|
|
+ if(index<0)
|
|
|
|
+ continue;
|
|
|
|
+ //console.log('find project'+items[i].title);
|
|
|
|
+ for(let j=0;j<items[i].children.length;j++)
|
|
|
|
+ {
|
|
|
|
+ let itemIndex = _self.findDtlByName(index,items[i].children[j].title);
|
|
|
|
+
|
|
|
|
+ if(itemIndex>=0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('find dtl'+items[i].children[j].title);
|
|
|
|
+ _self.projects[index].items[itemIndex].checked = true;
|
|
|
|
+ _self.projects[index].selectedIndex = itemIndex;
|
|
|
|
+ _self.projects[index].items[itemIndex].data_id = items[i].children[j].id;
|
|
|
|
+ _self.projects[index].items[itemIndex].value = items[i].children[j].unitScore;
|
|
|
|
+ //_self.projects[index].items[itemIndex].value = 3.3
|
|
|
|
+ //console.log('id '+ _self.projects[index].items[itemIndex].id);
|
|
|
|
+ //let element = document.getElementById(_self.projects[index].items[itemIndex].id);
|
|
|
|
+ //if(element)
|
|
|
|
+ // element.data1 = items[i].children[j].unitScore;
|
|
|
|
+ // console.log('object'+ JSON.stringify(this.$refs[_self.projects[index].items[itemIndex].id]))
|
|
|
|
+ //console.log('item'+JSON.stringify(_self.projects[index].items[itemIndex]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(!items || items.length==0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('fail xxxx')
|
|
|
|
+ for(let i = 0;i < _self.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ _self.projects[i].selectedIndex = -1;
|
|
|
|
+ //console.log('xxx fail xxxx')
|
|
|
|
+ for(let j = 0;j<_self.projects[i].items.length;j++)
|
|
|
|
+ {
|
|
|
|
+ _self.projects[i].items[j].checked = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //console.log('failed failed')
|
|
|
|
+ }
|
|
|
|
+ _self.calc_score();
|
|
|
|
+ loadMonthAssess = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ console.log('fail refreshDayAssess')
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.exception,
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=>{
|
|
|
|
+ console.log('requrest failed refreshDayAssess')
|
|
|
|
+ console.log(res);
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:'请求服务失败,请检查网络!',
|
|
|
|
+ showCancel:false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ complete:()=>{
|
|
|
|
+ //uni.hideLoading();
|
|
|
|
+ /*_self.LoadWorkLog(this.year,this.month);
|
|
|
|
+ if(!loadMonthAssess)
|
|
|
|
+ {
|
|
|
|
+ if(!items || items.length==0)
|
|
|
|
+ {
|
|
|
|
+ //console.log('fail xxxx')
|
|
|
|
+ for(let i = 0;i < _self.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ _self.projects[i].selectedIndex = -1;
|
|
|
|
+ //console.log('xxx fail xxxx')
|
|
|
|
+ for(let j = 0;j<_self.projects[i].items.length;j++)
|
|
|
|
+ {
|
|
|
|
+ _self.projects[i].items[j].checked = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //console.log('failed failed')
|
|
|
|
+ }
|
|
|
|
+ _self.score= _self.calc_score();
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ refreshEmployeeList()
|
|
|
|
+ {
|
|
|
|
+ //console.log('url'+this.kpi_url+' usId' + this.employeeID)
|
|
|
|
+ uni.request({
|
|
|
|
+ url: this.kpi_url+ '/api/loadNeedAssessUsers.do',//'http://192.168.77.99:8080/api/loadMonthWorkSummary.do',//?workNum='+this.employeeNumber+'&workMonth='+this.workMonth, //仅为示例,并非真实接口地址。
|
|
|
|
+ data:{usId:this.employeeID},
|
|
|
|
+ method:'GET',
|
|
|
|
+ timeout:20000,
|
|
|
|
+
|
|
|
|
+ success: (res) => {
|
|
|
|
+ //console.log('res1111'+JSON.stringify(res.data));
|
|
|
|
+
|
|
|
|
+ if(res.data.success){
|
|
|
|
+
|
|
|
|
+ let employees = res.data.data;
|
|
|
|
+ //this.$refs.ren.set_status(year,month);
|
|
|
|
+
|
|
|
|
+ if(employees)
|
|
|
|
+ {
|
|
|
|
+ _self.employees = [];//employees;
|
|
|
|
+ let findEmployee = false;
|
|
|
|
+ for(let i = 0;i< employees.length;i++)
|
|
|
|
+ {
|
|
|
|
+ let employee = {id:employees[i].id,value:employees[i].name};
|
|
|
|
+ _self.employees.push(employee);
|
|
|
|
+ if(!findEmployee)
|
|
|
|
+ {
|
|
|
|
+ //console.log('id '+ _self.employee.id + ' id: ' + employee.id);
|
|
|
|
+ if(_self.employee.id == employee.id)
|
|
|
|
+ {
|
|
|
|
+ findEmployee = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //console.log('data '+JSON.stringify( _self.employees));
|
|
|
|
+ if(!findEmployee)
|
|
|
|
+ {
|
|
|
|
+ //console.log('not find data ');
|
|
|
|
+ if(_self.employees.length>0)
|
|
|
|
+ {
|
|
|
|
+ _self.employee = {"id":_self.employees[0].id,"name":_self.employees[0].value};//self.employees[0];
|
|
|
|
+ //console.log('data '+JSON.stringify(_self.employee));
|
|
|
|
+ _self.LoadKpiTemplate(_self.employee.id,_self.employeeID);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ console.log('fail refreshEmployeeList')
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.exception,
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=>{
|
|
|
|
+ console.log('requrest failed')
|
|
|
|
+ console.log(res);
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:'请求服务失败,请检查网络!',
|
|
|
|
+ showCancel:false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ complete:()=>{
|
|
|
|
+ //uni.hideLoading();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ calc_score()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ let total_score = 0;
|
|
|
|
+ if(this.projects)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ for(let i = 0;i< this.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ let project = this.projects[i];
|
|
|
|
+ if(project)
|
|
|
|
+ {
|
|
|
|
+ //console.log('item'+JSON.stringify(project));
|
|
|
|
+ for(let j=0;j<project.items.length;j++)
|
|
|
|
+ {
|
|
|
|
+ let dtl = project.items[j];
|
|
|
|
+ if(project.is_multiple)
|
|
|
|
+ {
|
|
|
|
+ //console.log('multiple')
|
|
|
|
+ if(dtl.value!= null && dtl.value>0)
|
|
|
|
+ {
|
|
|
|
+ total_score+= dtl.value*dtl.score;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //console.log('not multiple')
|
|
|
|
+ if(dtl.score!=null)
|
|
|
|
+ {
|
|
|
|
+ total_score+=dtl.score;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.score = total_score;//console.log('score'+total_score);
|
|
|
|
+ return total_score;
|
|
|
|
+ },
|
|
|
|
+ process_data(scoreDataParent,scoreData) {
|
|
|
|
+
|
|
|
|
+ if(scoreData.children == null){
|
|
|
|
+
|
|
|
|
+ if(scoreData.value == 0){
|
|
|
|
+ if(scoreData.data_id != null)
|
|
|
|
+ {
|
|
|
|
+ this.submit_projects.children.push(scoreData);
|
|
|
|
+ }
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ this.submit_projects.children.push(scoreData);
|
|
|
|
+ }
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ if(scoreData.isMultiple!=null && scoreData.isMultiple == true){
|
|
|
|
+ let data = Object.assign({},scoreData);
|
|
|
|
+ data.children = [];
|
|
|
|
+ for(let j = 0; j < scoreData.children.length; j++){
|
|
|
|
+ if(scoreData.children[j].value != 0)
|
|
|
|
+ {
|
|
|
|
+ data.children.push(scoreData.children[j]);
|
|
|
|
+ }else if(scoreData.children[j].data_id != null)
|
|
|
|
+ {
|
|
|
|
+ data.children.push(scoreData.children[j]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(data.children.length>0){
|
|
|
|
+ this.submit_projects.children.push(data);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ for(let j = 0;j<scoreData.children.length;j++)
|
|
|
|
+ {
|
|
|
|
+ this.process_data(scoreData,scoreData.children[j]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ back() {
|
|
|
|
+ console.log('test')
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ formsubmit:function(e)
|
|
|
|
+ {
|
|
|
|
+ let datestr = utils.get_date_str(new Date(this.year,this.month-1,this.day));
|
|
|
|
+
|
|
|
|
+ let datas = {id:'',data_id:null,name:'日评数据',value:0,score:0,unit:null,type:2,isMultiple:true,sliderMin:0,sliderMax:1, sliderStep:0,children:[],date:datestr,userId:this.employee.id, evalId:this.employeeID,level:this.level,radio:null};
|
|
|
|
+
|
|
|
|
+ if(this.projects)
|
|
|
|
+ {
|
|
|
|
+ for(let i = 0;i< this.projects.length;i++)
|
|
|
|
+ {
|
|
|
|
+ let project = this.projects[i];
|
|
|
|
+ if(project)
|
|
|
|
+ {
|
|
|
|
+ let parent = {id:project.id,data_id:null,name:project.name,value:project.value,score:project.score,unit:project.unit,type:project.type,isMultiple:project.is_multiple,sliderMin:project.slider_min,sliderMax:project.slider_max, sliderStep:project.slider_step,children:[],date:datestr,userId:this.employee.id, evalId:this.employeeID,level:this.level,radio:null};
|
|
|
|
+
|
|
|
|
+ for(let j=0;j<project.items.length;j++)
|
|
|
|
+ {
|
|
|
|
+ let dtl = project.items[j];
|
|
|
|
+ if(project.items[j].data_id != null ||
|
|
|
|
+ (project.items[j].value != null && project.items[j].value>0))
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ let data ={};
|
|
|
|
+ if(project.items[j].id != null)
|
|
|
|
+ data.id = project.items[j].id;
|
|
|
|
+ if(project.items[j].data_id != null)
|
|
|
|
+ data.data_id = project.items[j].data_id;
|
|
|
|
+ if(project.items[j].text != null)
|
|
|
|
+ data.name = project.items[j].text;
|
|
|
|
+ if(project.items[j].value != null)
|
|
|
|
+ data.value = project.items[j].value;
|
|
|
|
+ if(project.items[j].score != null)
|
|
|
|
+ data.score = project.items[j].score;
|
|
|
|
+ if(project.items[j].unit != null)
|
|
|
|
+ data.unit = project.items[j].unit;
|
|
|
|
+ if(project.items[j].type != null)
|
|
|
|
+ data.type = project.items[j].type;
|
|
|
|
+ if(project.items[j].is_multiple != null)
|
|
|
|
+ data.isMultiple = project.items[j].is_multiple;
|
|
|
|
+ if(project.items[j].slider_step != null)
|
|
|
|
+ data.sliderStep = project.items[j].slider_step;
|
|
|
|
+ if(project.items[j].slider_max != null)
|
|
|
|
+ data.sliderMax = project.items[j].slider_max;
|
|
|
|
+ if(project.items[j].slider_min != null)
|
|
|
|
+ data.sliderMin = project.items[j].slider_min;
|
|
|
|
+ data.userId = this.employee.id;
|
|
|
|
+ data.evalId = this.employeeID;
|
|
|
|
+ data.date = datestr;
|
|
|
|
+ data.level = this.level;
|
|
|
|
+ if(project.items[j].slider_max == 1 && project.items[j].slider_min ==0)
|
|
|
|
+ {
|
|
|
|
+ data.radio = project.items[j].id;
|
|
|
|
+ }
|
|
|
|
+ parent.children.push(data);
|
|
|
|
+ //console.log('dtl 初始值' + JSON.stringify(project.items[j]));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(parent.children.length>0)
|
|
|
|
+ datas.children.push(parent);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //console.log('data'+JSON.stringify(datas));
|
|
|
|
+
|
|
|
|
+ uni.request({
|
|
|
|
+ url: this.kpi_url+ '/api/saveDayAssess.do',//'http://192.168.77.99:8080/api/loadMonthWorkSummary.do',//?workNum='+this.employeeNumber+'&workMonth='+this.workMonth, //仅为示例,并非真实接口地址。
|
|
|
|
+ data:datas,
|
|
|
|
+ headers: {
|
|
|
|
+ "Content-Type": "application/json"
|
|
|
|
+ },
|
|
|
|
+ method:'POST',
|
|
|
|
+ timeout:20000,
|
|
|
|
+
|
|
|
|
+ success: (res) => {
|
|
|
|
+ //console.log('res'+JSON.stringify(res.data));
|
|
|
|
+ //return;
|
|
|
|
+ if(res.data.success){
|
|
|
|
+
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url:'../daily_report_detail/daily_report_detail',
|
|
|
|
+ success: function(res) {
|
|
|
|
+ // 通过eventChannel向被打开页面传送数据
|
|
|
|
+ //console.log('fill xxxx')
|
|
|
|
+ res.eventChannel.emit('acceptDataFromOpenerPage', { data:
|
|
|
|
+ {action:'daily_comment_score',year:Number(_self.year),month:Number(_self.month),day:Number(_self.day),
|
|
|
|
+ id:_self.employee.id.toString(),name:_self.employee.name,employees:_self.employees} })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ //console.log('fail')
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: res.data.exception,
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 2000
|
|
|
|
+ });
|
|
|
|
+ /*uni.navigateTo({
|
|
|
|
+ url:'../employee_daily_report/employee_daily_report',
|
|
|
|
+ success: function(res) {
|
|
|
|
+ // 通过eventChannel向被打开页面传送数据
|
|
|
|
+ //console.log('fill xxxx')
|
|
|
|
+ res.eventChannel.emit('acceptDataFromOpenerPage', { data: {action:'month_comment_score',year:_self.year,month:_self.month,day:_self.day,id:data.id,name:_self.employee.name,employees:_self.employees} })
|
|
|
|
+ }
|
|
|
|
+ })*/
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ fail:(res)=>{
|
|
|
|
+ console.log('requrest failed')
|
|
|
|
+ //console.log(res);
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title:'提示',
|
|
|
|
+ content:'请求服务失败,请检查网络!',
|
|
|
|
+ showCancel:false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ complete:()=>{
|
|
|
|
+ uni.hideLoading();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ //console.log('formsubmit');
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss">
|
|
|
|
+ @import "@/common/pa_main.scss";
|
|
|
|
+
|
|
|
|
+ .content {
|
|
|
|
+ //padding-top: 50rpx;
|
|
|
|
+ .change{
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ margin-top: 100rpx;
|
|
|
|
+ height: 100rpx;
|
|
|
|
+ color: #b89249;
|
|
|
|
+ background-color: #21191b;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ .head-box
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+</style>
|