|
@@ -0,0 +1,555 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ title="任务更新"
|
|
|
+ :visible.sync="taskVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :show-close="false"
|
|
|
+ top="5%"
|
|
|
+ width="600px"
|
|
|
+ @open="loadDetail"
|
|
|
+ >
|
|
|
+ <el-form :model="formData" ref="formData" label-width="80px" v-loading="loading" >
|
|
|
+ <el-form-item
|
|
|
+ label="任务内容"
|
|
|
+ prop="task_name"
|
|
|
+ :rules="[{required:true,message:'请填写任务内容'},{min:3,max:20,message: '长度在3到20个字'}]"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ rows="3"
|
|
|
+ maxlength="20"
|
|
|
+ show-word-limit
|
|
|
+ v-model="formData.task_name"
|
|
|
+ @input="onTaskNameInput"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="积分类型"
|
|
|
+ prop="pt_id"
|
|
|
+ :rules="[{required:true,message:'请选择规则积分'}]"
|
|
|
+ >
|
|
|
+ <el-radio-group
|
|
|
+ v-model="formData.pt_id"
|
|
|
+ >
|
|
|
+ <el-radio v-for="(item,index) in pts" :key="index" v-show="item.code !== 'JX'" :label="item.id">{{item.name}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <span class="blue cursor" style="padding-left: 20px;font-size: 14px;" @click="$openUrl(17)">什么是A分、B分?</span>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="指定规则">
|
|
|
+ <el-radio-group v-model="formData.rule_type">
|
|
|
+ <el-radio-button :label="0">不指定</el-radio-button>
|
|
|
+ <el-radio-button :label="1">规则分类</el-radio-button>
|
|
|
+ <el-radio-button :label="2">指定规则</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="规则分类" prop="rule_id" v-if="formData.rule_type === 1" :rules="[{required:true,message:'请选择规则分类'}]">
|
|
|
+ <el-cascader
|
|
|
+ class="w250"
|
|
|
+ v-model="formData.rule_id"
|
|
|
+ :options="rule_list"
|
|
|
+ :props="{children:'child',label:'name',value:'id', checkStrictly: true,emitPath:false}"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="积分规则" prop="rule_item.remark" v-if="formData.rule_type === 2" :rules="[{required:true,message:'请选择积分规则'}]">
|
|
|
+ <el-input placeholder="请选择规则" v-model="formData.rule_item.remark" :disabled="true">
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click.stop="showRuleItems = true"/>
|
|
|
+ </el-input>
|
|
|
+ <i style="color: red">{{itemRemark}}</i>
|
|
|
+ <SelectRule
|
|
|
+ :visible.sync="showRuleItems"
|
|
|
+ :pt-id = "formData.pt_id"
|
|
|
+ :select-items="selectItem"
|
|
|
+ :is-scope="true"
|
|
|
+ :multiple="false"
|
|
|
+ @confirm="onItemConfirm"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="任务积分" prop="base_point" :rules="[{ required: true, message: '请填写任务积分'}]">
|
|
|
+ <el-input-number ref="base_point" v-model="formData.base_point" :disabled="formData.rule_item.range_type === 1" @change="onBasePointChange"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="执行人" prop="targets" :rules="[{ required: true, message: '请选择执行人'}]">
|
|
|
+ <el-input auto-complete="off" :disabled="true" v-model="formData.target_name" placeholder="请选择执行人">
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click.stop="showApproval = true" />
|
|
|
+ </el-input>
|
|
|
+ <!-- 执行人 -->
|
|
|
+ <EmployeeSelector
|
|
|
+ :employee_list="employee_list"
|
|
|
+ :user_employee_list="true"
|
|
|
+ :multi="false"
|
|
|
+ :selected="formData.target_selected"
|
|
|
+ :visible.sync="showApproval"
|
|
|
+ @confirm="approval_confirm"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="审批人" prop="reviewer_id" :rules="[{ required: true, message: '请选择审批人'}]">
|
|
|
+ <el-input auto-complete="off" v-model="formData.reviewer_name" placeholder="请选择审批人" :disabled="true">
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click.stop="showReviewer = true" />
|
|
|
+ </el-input>
|
|
|
+ <EmployeeSelector
|
|
|
+ :multi="false"
|
|
|
+ :is-chec-ked-all="false"
|
|
|
+ :is_manager_only="true"
|
|
|
+ :is_filtration_creator="false"
|
|
|
+ :selected="formData.reviewer_selected"
|
|
|
+ :visible.sync="showReviewer"
|
|
|
+ @confirm="reviewer_confirm"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="截止时间"
|
|
|
+ prop="expire_time"
|
|
|
+ :rules="[{required:true,message:'请选择截止时间'}]"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="formData.expire_time"
|
|
|
+ type="datetime"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ placeholder="选择截止时间"
|
|
|
+ format="yyyy-MM-dd HH:mm"
|
|
|
+ value-format="yyyy-MM-dd HH:mm"
|
|
|
+ default-time="18:00"
|
|
|
+ :clearable="false"
|
|
|
+ />
|
|
|
+ <el-tooltip placement="right" style="margin-left: 10px" content="任务截止时间是触发任务提前奖分/逾期扣分的关键属性"><span class="tips">?</span></el-tooltip>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item
|
|
|
+ label="任务备注"
|
|
|
+ prop="task_remark"
|
|
|
+ :rules="[{max:300,message:'只允许最多300个字'}]"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ :rows="5"
|
|
|
+ maxlength="300"
|
|
|
+ show-word-limit
|
|
|
+ v-model="formData.task_remark"
|
|
|
+ @input="onTaskRemarkInput"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <div style="margin-left: 80px; margin-bottom: 8px;">以天为单位,每 提前/逾期 一天 加分/扣分</div>
|
|
|
+ <el-form-item
|
|
|
+ label="提前奖分"
|
|
|
+ prop="ahead_award_point"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="formData.ahead_award_point"
|
|
|
+ @input="v => formData.ahead_award_point = v.replace(/[^\d]/g,'')"
|
|
|
+ placeholder="请输入每日奖分" style="width: 150px;"
|
|
|
+ />
|
|
|
+ B分/每天,
|
|
|
+ 奖分上限
|
|
|
+ <el-input
|
|
|
+ v-model="formData.ahead_award_point_limit"
|
|
|
+ @input="v => formData.ahead_award_point_limit = v.replace(/[^\d]/g,'')"
|
|
|
+ placeholder="请输入奖分上限"
|
|
|
+ style="width: 150px;"
|
|
|
+ />
|
|
|
+ B分
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ label="逾期扣分"
|
|
|
+ prop="timeout_deduction_point"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="formData.timeout_deduction_point"
|
|
|
+ @input="v => formData.timeout_deduction_point = v.replace(/[^\d]/g,'')"
|
|
|
+ placeholder="请输入每日扣分"
|
|
|
+ style="width: 150px;"/>
|
|
|
+ B分/每天,扣分上限
|
|
|
+ <el-input
|
|
|
+ v-model="formData.timeout_deduction_point_limit"
|
|
|
+ @input="v => formData.timeout_deduction_point_limit = v.replace(/[^\d]/g,'')"
|
|
|
+ placeholder="请输入扣分上限"
|
|
|
+ style="width: 150px;"
|
|
|
+ />
|
|
|
+ B分
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click.stop="close">关闭</el-button>
|
|
|
+ <el-button type="primary" @click.stop="taskSubmit">提交</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import Template from "../../../examine/components/Template.vue";
|
|
|
+import SelectRule from "../../../components/SelectRule.vue";
|
|
|
+import EmployeeSelector from "../../../components/EmployeeSelector.vue";
|
|
|
+import {specialFilter} from "../../../utils";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "TaskUpdate",
|
|
|
+ components: {EmployeeSelector, SelectRule, Template},
|
|
|
+ props:{
|
|
|
+ taskVisible:{
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ workId:{
|
|
|
+ type: Number,
|
|
|
+ default:0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ firstInit:true,
|
|
|
+ pts:this.$getTyps(),
|
|
|
+ employee_list: this.$store.getters.user_info.employee_detail.manage_scope,
|
|
|
+ showApproval:false,
|
|
|
+ showReviewer:false,
|
|
|
+ pickerOptions:{
|
|
|
+ disabledDate (time) {
|
|
|
+ //disabledDate 文档上:设置禁用状态,参数为当前日期,要求返回 Boolean
|
|
|
+ // return time.getTime() > Date.now()//选当前时间之前的时间
|
|
|
+ let num=60*60*24*1000
|
|
|
+ return (time.getTime()+num) < Date.now()//选当前时间之后的时间
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 执行者
|
|
|
+ loading:false,
|
|
|
+ rule_list:[],
|
|
|
+ showRuleItems:false,
|
|
|
+ formData:{
|
|
|
+ rule_type:0,
|
|
|
+ rule_id:0,
|
|
|
+ item_id:0,
|
|
|
+ rule_item:{
|
|
|
+ id:0,
|
|
|
+ remark:"",
|
|
|
+ cycle_type: 0,
|
|
|
+ is_attendance: 0,
|
|
|
+ max_point: 0,
|
|
|
+ min_point: 0,
|
|
|
+ prize_type: 0,
|
|
|
+ pt_id: 0,
|
|
|
+ range_type: 0,
|
|
|
+ },
|
|
|
+ task_name: '',
|
|
|
+ base_point: '',
|
|
|
+ task_remark: '',
|
|
|
+ pt_id: 3,
|
|
|
+ expire_time: '',
|
|
|
+ targets: [],
|
|
|
+ target_name:'',
|
|
|
+ target_selected:{ dept: [], employee: [] },
|
|
|
+ reviewer_id: 0,
|
|
|
+ reviewer_name:'',
|
|
|
+ reviewer_selected:{ dept: [], employee: [] },
|
|
|
+ timeout_deduction_point: null,
|
|
|
+ timeout_deduction_point_limit: null,
|
|
|
+ ahead_award_point: null,
|
|
|
+ ahead_award_point_limit: null,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ 'formData.rule_type'(val,old) {
|
|
|
+ if (!this.firstInit) this.initRuleData()
|
|
|
+ this.firstInit = false //防止一进来就将规则选项重置
|
|
|
+ },
|
|
|
+ 'formData.pt_id'(val,old){
|
|
|
+ if (!this.firstInit && this.formData.rule_type === 2) this.initRuleData()
|
|
|
+ this.firstInit = false //防止一进来就将规则选项重置
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ selectItem(){
|
|
|
+ return this.formData.rule_item && this.formData.rule_item.id ? [this.formData.rule_item] : []
|
|
|
+ },
|
|
|
+ itemRemark(){
|
|
|
+ let pt = this.pts.find(pt => pt.id === this.formData.rule_item.pt_id)
|
|
|
+ pt = pt ? pt.name : ''
|
|
|
+ switch (this.formData.rule_item.range_type){
|
|
|
+ case 1:
|
|
|
+ return `${this.formData.rule_item.min_point} ${pt}`
|
|
|
+ case 2:
|
|
|
+ return `${this.formData.rule_item.min_point} -- ${this.formData.rule_item.max_point} ${pt}`
|
|
|
+ default:
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ initRuleData(){
|
|
|
+ this.formData.rule_id = 0
|
|
|
+ this.formData.item_id = 0
|
|
|
+ this.formData.rule_item = {
|
|
|
+ id:0,
|
|
|
+ remark:"",
|
|
|
+ cycle_type: 0,
|
|
|
+ is_attendance: 0,
|
|
|
+ max_point: 0,
|
|
|
+ min_point: 0,
|
|
|
+ prize_type: 0,
|
|
|
+ pt_id: 0,
|
|
|
+ range_type: 0,
|
|
|
+ }
|
|
|
+ this.formData.base_point = 1
|
|
|
+ },
|
|
|
+ close(){
|
|
|
+ this.$emit('update:taskVisible',false)
|
|
|
+ },
|
|
|
+ loadDetail(){
|
|
|
+ if (this.workId <= 0) return
|
|
|
+ let self = this
|
|
|
+ self.loading = true
|
|
|
+ self.firstInit = true
|
|
|
+ let data = {
|
|
|
+ work_id: this.workId
|
|
|
+ }
|
|
|
+ this.$axiosUser('get','/api/pro/integral/work',data)
|
|
|
+ .then(res =>{
|
|
|
+ if (res.data.code !== 1) {
|
|
|
+ self.$message.error(res.data.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let info = res.data.data
|
|
|
+ let formData = {
|
|
|
+ rule_type:0,
|
|
|
+ rule_id:info.rule_id,
|
|
|
+ item_id:info.item_id,
|
|
|
+ rule_item:{
|
|
|
+ id:0,
|
|
|
+ remark:"",
|
|
|
+ cycle_type: 0,
|
|
|
+ is_attendance: 0,
|
|
|
+ max_point: 0,
|
|
|
+ min_point: 0,
|
|
|
+ prize_type: 0,
|
|
|
+ pt_id: 0,
|
|
|
+ range_type: 0,
|
|
|
+ },
|
|
|
+ task_name: info.task_name,
|
|
|
+ base_point: info.point_config.base_point || 0,
|
|
|
+ task_remark: info.task_remark,
|
|
|
+ pt_id: info.pt_id,
|
|
|
+ expire_time: info.expire_time,
|
|
|
+ targets: [info.employee_id],
|
|
|
+ target_name:info.employee_name,
|
|
|
+ target_selected:{ dept: [], employee: [{id:info.employee_id,img_url:info.img_url,name:info.employee_name}] },
|
|
|
+ reviewer_id: info.reviewer_id,
|
|
|
+ reviewer_name:info.reviewer_name,
|
|
|
+ reviewer_selected:{ dept: [], employee: [{id:info.reviewer_id,img_url:info.reviewer_img_url,name:info.reviewer_name}] },
|
|
|
+ timeout_deduction_point: info.point_config.timeout_deduction_point || '',
|
|
|
+ timeout_deduction_point_limit: info.point_config.timeout_deduction_point_limit || '',
|
|
|
+ ahead_award_point: info.point_config.ahead_award_point || '',
|
|
|
+ ahead_award_point_limit: info.point_config.ahead_award_point_limit || '',
|
|
|
+ }
|
|
|
+ if (info.item_info){
|
|
|
+ formData.rule_item = {
|
|
|
+ id:info.item_id,
|
|
|
+ remark:info.item_info.remark,
|
|
|
+ cycle_type: info.item_info.cycle_type,
|
|
|
+ is_attendance: info.item_info.is_attendance,
|
|
|
+ max_point: info.item_info.max_point,
|
|
|
+ min_point: info.item_info.min_point,
|
|
|
+ prize_type: info.item_info.prize_type,
|
|
|
+ pt_id: info.item_info.pt_id,
|
|
|
+ range_type: info.item_info.range_type,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.rule_type = info.item_id && info.rule_id ? 2 : (info.rule_id ? 1 : 0)
|
|
|
+ self.formData = formData
|
|
|
+ self.loading = false
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ self.$message.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getRuleList(){
|
|
|
+ let data = {
|
|
|
+ cycle_type:'1',
|
|
|
+ pt_id: this.formData.pt_id
|
|
|
+ }
|
|
|
+ this.$axiosUser('get','/api/pro/integral/rule/trees/scope',data)
|
|
|
+ .then(res => {
|
|
|
+ this.rule_list = this.getTreeData(res.data.data.rule_tree)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getTreeData(data) {
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ if (data[i].child.length < 1) {
|
|
|
+ // child若为空数组,则将child设为undefined
|
|
|
+ data[i].child = undefined;
|
|
|
+ } else {
|
|
|
+ // child若不为空数组,则继续 递归调用 本方法
|
|
|
+ this.getTreeData(data[i].child);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ onItemConfirm(selectArrItem){
|
|
|
+ this.formData.rule_item = selectArrItem.length > 0 ? selectArrItem[0] : {
|
|
|
+ id:0,
|
|
|
+ remark:"",
|
|
|
+ cycle_type: 0,
|
|
|
+ is_attendance: 0,
|
|
|
+ max_point: 0,
|
|
|
+ min_point: 0,
|
|
|
+ prize_type: 0,
|
|
|
+ pt_id: 0,
|
|
|
+ range_type: 0,
|
|
|
+ }
|
|
|
+ this.formData.item_id = this.formData.rule_item.id
|
|
|
+ this.formData.rule_id = this.formData.rule_item.rule_id
|
|
|
+ this.formData.base_point = this.formData.rule_item.min_point !== 0 ? this.formData.rule_item.min_point : 1
|
|
|
+ },
|
|
|
+ onBasePointChange(currentValue,oldValue){
|
|
|
+ //限制范围分的上下限拦截
|
|
|
+ if (this.formData.rule_type !== 2 && this.formData.rule_item.range_type !== 2) return
|
|
|
+
|
|
|
+ if (currentValue < this.formData.rule_item.min_point) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.formData.base_point = this.formData.rule_item.min_point
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (currentValue > this.formData.rule_item.max_point) {
|
|
|
+ this.$nextTick( () => {
|
|
|
+ this.formData.base_point = this.formData.rule_item.max_point
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ approval_confirm(data) {
|
|
|
+ this.formData.target_selected = { dept: [], employee: [] };
|
|
|
+ this.formData.targets = [];
|
|
|
+ this.formData.target_name = '';
|
|
|
+ if (data.employee !== null && data.employee.length != 0) {
|
|
|
+ this.formData.target_selected = data;
|
|
|
+ this.formData.targets.push(data.employee[0].id);
|
|
|
+ this.formData.target_name = data.employee[0].name;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ reviewer_confirm(data){
|
|
|
+ this.formData.reviewer_selected = { dept: [], employee: [] };
|
|
|
+ this.formData.reviewer_id = '';
|
|
|
+ this.formData.reviewer_name = '';
|
|
|
+ if (data.employee !== null && data.employee.length != 0) {
|
|
|
+ this.formData.reviewer_selected = data;
|
|
|
+ this.formData.reviewer_id = data.employee[0].id;
|
|
|
+ this.formData.reviewer_name = data.employee[0].name;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTaskNameInput(val){
|
|
|
+ this.formData.task_name = specialFilter(val)
|
|
|
+ },
|
|
|
+ onTaskRemarkInput(val){
|
|
|
+ this.formData.task_remark = specialFilter(val)
|
|
|
+ },
|
|
|
+ ahead_timeout(item,arr,codes,code){
|
|
|
+ if(item){
|
|
|
+ if(arr){
|
|
|
+ if(Number(item) > Number(arr)){
|
|
|
+ this.$message.warning(code +'上限不能小于每日'+ codes)
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.warning( codes + '不为0时,'+ code +'上限不能为空')
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ taskSubmit(){
|
|
|
+ if (this.formData.rule_type === 1 && this.formData.rule_id <= 0){
|
|
|
+ this.$message.error("请选择规则分类")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.formData.rule_type === 2 && this.formData.item_id <= 0){
|
|
|
+ this.$message.error("请选择规积分规则")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs['formData'].validate(valid => {
|
|
|
+ if (valid){
|
|
|
+ let data = {
|
|
|
+ ahead_award_point:this.formData.ahead_award_point ? this.formData.ahead_award_point : 0,
|
|
|
+ ahead_award_point_limit:this.formData.ahead_award_point_limit ? this.formData.ahead_award_point_limit : 0,
|
|
|
+ timeout_deduction_point:this.formData.timeout_deduction_point ? this.formData.timeout_deduction_point : 0,
|
|
|
+ timeout_deduction_point_limit:this.formData.timeout_deduction_point_limit ? this.formData.timeout_deduction_point_limit : 0,
|
|
|
+ targets:this.formData.targets,
|
|
|
+ task_name:this.formData.task_name,
|
|
|
+ task_remark:this.formData.task_remark,
|
|
|
+ rule_id:this.formData.rule_id,
|
|
|
+ item_id:this.formData.item_id,
|
|
|
+ id:this.workId,
|
|
|
+ base_point:this.formData.base_point,
|
|
|
+ expire_time:this.formData.expire_time,
|
|
|
+ reviewer_id:this.formData.reviewer_id,
|
|
|
+ package_id:0,
|
|
|
+ weight:0,
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!data.ahead_award_point && data.ahead_award_point_limit){
|
|
|
+ this.$message.warning('奖分上限不为0时,提前奖分不能为空')
|
|
|
+ return
|
|
|
+ }else if(data.ahead_award_point && !data.ahead_award_point_limit){
|
|
|
+ this.$message.warning('提前奖分不为0时,奖分上限不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!data.timeout_deduction_point && data.timeout_deduction_point_limit){
|
|
|
+ this.$message.warning('扣分上限不为0时,逾期扣分不能为空')
|
|
|
+ return
|
|
|
+ }else if(data.timeout_deduction_point && !data.timeout_deduction_point_limit){
|
|
|
+ this.$message.warning('逾期扣分不为0时,扣分上限不能为空')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.ahead_timeout(data.ahead_award_point,data.ahead_award_point_limit,'提前奖分','奖分')) return
|
|
|
+ if(this.ahead_timeout(data.timeout_deduction_point,data.timeout_deduction_point_limit,'逾期扣分','扣分')) return
|
|
|
+
|
|
|
+ let point_limit = this.$userInfo().point_config.point_limit ? this.$userInfo().point_config.point_limit.find(pt => pt.pt_id === 3) : null
|
|
|
+ if(!this.$supremeAuthority('creator') && point_limit){
|
|
|
+ let entry_limit = Number(point_limit.point)
|
|
|
+ if(entry_limit > 0){
|
|
|
+ if(data.ahead_award_point > entry_limit || data.timeout_deduction_point > entry_limit ){
|
|
|
+ this.$message.warning('每日奖扣分 不能超过您的奖扣分权限(您的奖扣分权限:' + entry_limit + '分)')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(data.ahead_award_point_limit > entry_limit*10 || data.timeout_deduction_point_limit > entry_limit*10 ){
|
|
|
+ this.$message.warning('奖扣分上限不能超过' + entry_limit*10 + '分(您的奖扣分权限' + entry_limit + '分*10)')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let self = this
|
|
|
+ self.loading = true
|
|
|
+
|
|
|
+ self.$axiosUser('post', '/api/pro/integral/work/update', data)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code !== 1){
|
|
|
+ self.$message.error(res.data.msg)
|
|
|
+ self.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ self.$emit('hasSubmit')
|
|
|
+ self.$message.success(res.data.msg)
|
|
|
+ self.$emit('update:taskVisible',false)
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // self.$message.error(err)
|
|
|
+ self.loading = false
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getRuleList()
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+
|
|
|
+</style>
|