|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<el-dialog
|
|
|
- title="任务更新"
|
|
|
- :visible.sync="taskVisible"
|
|
|
+ title="悬赏更新"
|
|
|
+ :visible.sync="scheduleVisible"
|
|
|
:close-on-click-modal="false"
|
|
|
:show-close="false"
|
|
|
top="5%"
|
|
@@ -52,7 +52,6 @@
|
|
|
: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"/>
|
|
@@ -71,21 +70,6 @@
|
|
|
<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" />
|
|
@@ -126,25 +110,34 @@
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="5"
|
|
|
- maxlength="300"
|
|
|
show-word-limit
|
|
|
v-model="formData.task_remark"
|
|
|
@input="onTaskRemarkInput"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="可见范围" prop="dept_ids">
|
|
|
+ <el-input auto-complete="off" :disabled="true" v-model="formData.deptName" placeholder="请选中部门的人可领取">
|
|
|
+ <el-button slot="append" icon="el-icon-search" @click.stop="showDeptSelector = true"/>
|
|
|
+ </el-input>
|
|
|
+ <EmployeeSelector
|
|
|
+ :isChecKedAll="false"
|
|
|
+ :can_select_employee="false"
|
|
|
+ :can_select_dept="true"
|
|
|
+ :multi="true"
|
|
|
+ :selected="formData.dept_selected"
|
|
|
+ :visible.sync="showDeptSelector"
|
|
|
+ @confirm="dept_confirm"/>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
<div style="margin-left: 80px; margin-bottom: 8px;">以天为单位,每 提前/逾期 一天 加分/扣分</div>
|
|
|
- <el-form-item
|
|
|
- label="提前奖分"
|
|
|
- prop="ahead_award_point"
|
|
|
- >
|
|
|
+ <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;"
|
|
|
+ placeholder="请输入每日奖分"
|
|
|
+ style="width: 150px;"
|
|
|
/>
|
|
|
- B分/每天,
|
|
|
- 奖分上限
|
|
|
+ B分/每天, 奖分上限
|
|
|
<el-input
|
|
|
v-model="formData.ahead_award_point_limit"
|
|
|
@input="v => formData.ahead_award_point_limit = v.replace(/[^\d]/g,'')"
|
|
@@ -153,16 +146,14 @@
|
|
|
/>
|
|
|
B分
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="逾期扣分"
|
|
|
- prop="timeout_deduction_point"
|
|
|
- >
|
|
|
+ <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分/每天,扣分上限
|
|
|
+ style="width: 150px;"
|
|
|
+ />
|
|
|
+ B分/每天, 扣分上限
|
|
|
<el-input
|
|
|
v-model="formData.timeout_deduction_point_limit"
|
|
|
@input="v => formData.timeout_deduction_point_limit = v.replace(/[^\d]/g,'')"
|
|
@@ -171,41 +162,37 @@
|
|
|
/>
|
|
|
B分
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item>
|
|
|
- <el-button @click.stop="close">关闭</el-button>
|
|
|
- <el-button type="primary" @click.stop="taskSubmit">提交</el-button>
|
|
|
+ <el-button type="primary" @click="sub" >确认修改</el-button>
|
|
|
+ <el-button @click.stop="close">取消</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
-import Template from "../../../examine/components/Template.vue";
|
|
|
+import {specialFilter} from "../../../utils";
|
|
|
import SelectRule from "../../../components/SelectRule.vue";
|
|
|
import EmployeeSelector from "../../../components/EmployeeSelector.vue";
|
|
|
-import {specialFilter} from "../../../utils";
|
|
|
|
|
|
export default {
|
|
|
name: "TaskUpdate",
|
|
|
- components: {EmployeeSelector, SelectRule, Template},
|
|
|
+ components: {EmployeeSelector, SelectRule},
|
|
|
props:{
|
|
|
- taskVisible:{
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
+ scheduleVisible:{
|
|
|
+ type:Boolean,
|
|
|
+ default:false
|
|
|
},
|
|
|
- workId:{
|
|
|
- type: Number,
|
|
|
+ taskId:{
|
|
|
+ type:Number,
|
|
|
default:0
|
|
|
}
|
|
|
},
|
|
|
- data() {
|
|
|
+ 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
|
|
@@ -214,14 +201,21 @@ export default {
|
|
|
return (time.getTime()+num) < Date.now()//选当前时间之后的时间
|
|
|
}
|
|
|
},
|
|
|
- // 执行者
|
|
|
+ pts:this.$getTyps(),
|
|
|
+ employee_list: this.$store.getters.user_info.employee_detail.manage_scope,
|
|
|
+ showReviewer:false,
|
|
|
loading:false,
|
|
|
rule_list:[],
|
|
|
showRuleItems:false,
|
|
|
+ showDeptSelector:false,
|
|
|
formData:{
|
|
|
+ id:0,
|
|
|
rule_type:0,
|
|
|
rule_id:0,
|
|
|
item_id:0,
|
|
|
+ dept_ids:[],
|
|
|
+ deptName:null,
|
|
|
+ dept_selected: {dept: [],employee:[]},
|
|
|
rule_item:{
|
|
|
id:0,
|
|
|
remark:"",
|
|
@@ -232,15 +226,13 @@ export default {
|
|
|
prize_type: 0,
|
|
|
pt_id: 0,
|
|
|
range_type: 0,
|
|
|
+ rule_id:0
|
|
|
},
|
|
|
- task_name: '',
|
|
|
- base_point: '',
|
|
|
+ task_name:'',
|
|
|
+ base_point:0,
|
|
|
task_remark: '',
|
|
|
pt_id: 3,
|
|
|
expire_time: '',
|
|
|
- targets: [],
|
|
|
- target_name:'',
|
|
|
- target_selected:{ dept: [], employee: [] },
|
|
|
reviewer_id: 0,
|
|
|
reviewer_name:'',
|
|
|
reviewer_selected:{ dept: [], employee: [] },
|
|
@@ -248,17 +240,7 @@ export default {
|
|
|
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:{
|
|
@@ -278,6 +260,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ 'formData.rule_type'(v){
|
|
|
+ if (!this.firstInit) this.initRuleData()
|
|
|
+ this.firstInit = false //防止一进来就将规则选项重置
|
|
|
+ },
|
|
|
+ 'formData.pt_id'(v){
|
|
|
+ if (!this.firstInit && this.formData.rule_type === 2) this.initRuleData()
|
|
|
+ this.firstInit = false //防止一进来就将规则选项重置
|
|
|
+ },
|
|
|
+
|
|
|
+ },
|
|
|
methods:{
|
|
|
initRuleData(){
|
|
|
this.formData.rule_id = 0
|
|
@@ -292,31 +285,118 @@ export default {
|
|
|
prize_type: 0,
|
|
|
pt_id: 0,
|
|
|
range_type: 0,
|
|
|
+ rule_id:0
|
|
|
}
|
|
|
this.formData.base_point = 1
|
|
|
},
|
|
|
+ dept_confirm(data){
|
|
|
+ this.formData.dept_selected = {dept: [],employee:[]}
|
|
|
+ this.formData.dept_ids = []
|
|
|
+ this.formData.deptName = ''
|
|
|
+ if (data.dept !== null && data.dept.length != 0) {
|
|
|
+ this.formData.dept_selected = data
|
|
|
+ data.dept.forEach((element,index) => {
|
|
|
+ this.formData.dept_ids.push(element.dept_id)
|
|
|
+ this.formData.deptName += index === 0 ? element.dept_name : `,${element.dept_name}`
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onTaskRemarkInput(val){
|
|
|
+ this.formData.task_remark = specialFilter(val)
|
|
|
+ },
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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,
|
|
|
+ rule_id: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
|
|
|
+ },
|
|
|
close(){
|
|
|
- this.$emit('update:taskVisible',false)
|
|
|
+ this.$emit('update:scheduleVisible',false)
|
|
|
+ },
|
|
|
+ onTaskNameInput(val){
|
|
|
+ this.formData.task_name = specialFilter(val)
|
|
|
+ },
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ })
|
|
|
},
|
|
|
loadDetail(){
|
|
|
- if (this.workId <= 0) return
|
|
|
+ if (this.taskId <= 0) return
|
|
|
let self = this
|
|
|
self.loading = true
|
|
|
self.firstInit = true
|
|
|
let data = {
|
|
|
- work_id: this.workId
|
|
|
+ task_id:this.taskId
|
|
|
}
|
|
|
- this.$axiosUser('get','/api/pro/integral/work',data)
|
|
|
- .then(res =>{
|
|
|
+ self.$axiosUser('get','/api/pro/integral/task',data)
|
|
|
+ .then(res => {
|
|
|
if (res.data.code !== 1) {
|
|
|
self.$message.error(res.data.msg)
|
|
|
return
|
|
|
}
|
|
|
let info = res.data.data
|
|
|
let formData = {
|
|
|
+ id:info.id,
|
|
|
rule_type:0,
|
|
|
rule_id:info.rule_id,
|
|
|
item_id:info.item_id,
|
|
|
+ dept_ids:[],
|
|
|
+ deptName:'',
|
|
|
+ dept_selected: {dept: [],employee:[]},
|
|
|
rule_item:{
|
|
|
id:0,
|
|
|
remark:"",
|
|
@@ -327,22 +407,20 @@ export default {
|
|
|
prize_type: 0,
|
|
|
pt_id: 0,
|
|
|
range_type: 0,
|
|
|
+ rule_id:0
|
|
|
},
|
|
|
- task_name: info.task_name,
|
|
|
- base_point: info.point_config.base_point || 0,
|
|
|
+ task_name:info.task_name,
|
|
|
+ base_point:info.point_config.base_point,
|
|
|
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 || '',
|
|
|
+ reviewer_selected:{ dept: [], employee: [{id:info.reviewer_id,name:info.reviewer_name,img_url:info.reviewer_img_url}] },
|
|
|
+ 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 = {
|
|
@@ -355,94 +433,100 @@ export default {
|
|
|
prize_type: info.item_info.prize_type,
|
|
|
pt_id: info.item_info.pt_id,
|
|
|
range_type: info.item_info.range_type,
|
|
|
+ rule_id: info.rule_id
|
|
|
}
|
|
|
}
|
|
|
+ info.department_info.forEach((item,index) => {
|
|
|
+
|
|
|
+ formData.dept_selected.dept.push({
|
|
|
+ dept_id:item.id,
|
|
|
+ dept_name:item.name,
|
|
|
+ avatar:"static/images/e66f.jpg"
|
|
|
+ })
|
|
|
+ formData.deptName += (index === 0 ? item.name : `,${item.name}`)
|
|
|
+ formData.dept_ids.push(item.id)
|
|
|
+ })
|
|
|
+
|
|
|
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)
|
|
|
})
|
|
|
+ .finally(() => {
|
|
|
+ self.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
- getRuleList(){
|
|
|
+ sub(){
|
|
|
+ this.$refs['formData'].validate((valid) => {
|
|
|
+ if (valid) this.saveFun()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveFun(){
|
|
|
let data = {
|
|
|
- cycle_type:'1',
|
|
|
- pt_id: this.formData.pt_id
|
|
|
+ id:this.formData.id,
|
|
|
+ pt_id:this.formData.pt_id,
|
|
|
+ task_name:this.formData.task_name,
|
|
|
+ task_remark:this.formData.task_remark,
|
|
|
+ base_point:this.formData.base_point,
|
|
|
+ expire_time:this.formData.expire_time,
|
|
|
+ reviewer_id:this.formData.reviewer_id,
|
|
|
+ timeout_deduction_point:this.formData.timeout_deduction_point,
|
|
|
+ timeout_deduction_point_limit:this.formData.timeout_deduction_point_limit,
|
|
|
+ ahead_award_point:this.formData.ahead_award_point,
|
|
|
+ ahead_award_point_limit:this.formData.ahead_award_point_limit,
|
|
|
+ dept_ids:this.formData.dept_ids,
|
|
|
+ rule_id:this.formData.rule_id,
|
|
|
+ item_id:this.formData.item_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);
|
|
|
- }
|
|
|
+ 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
|
|
|
}
|
|
|
- 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,
|
|
|
+ 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
|
|
|
}
|
|
|
- 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(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
|
|
|
|
|
|
- if (currentValue < this.formData.rule_item.min_point) {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.formData.base_point = this.formData.rule_item.min_point
|
|
|
- })
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if (currentValue > this.formData.rule_item.max_point) {
|
|
|
- this.$nextTick( () => {
|
|
|
- this.formData.base_point = this.formData.rule_item.max_point
|
|
|
+
|
|
|
+ let self = this
|
|
|
+ self.loading = true
|
|
|
+ self.$axiosUser('post','/api/pro/integral/task/update',data)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code !== 1) throw new Error(res.data.msg)
|
|
|
+ self.$emit('hasSubmit')
|
|
|
+ self.$message.success(res.data.msg)
|
|
|
+ self.close()
|
|
|
})
|
|
|
- }
|
|
|
- },
|
|
|
- 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)
|
|
|
+ .catch(err => {
|
|
|
+ self.$message.error(err)
|
|
|
+ self.loading = false
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
ahead_timeout(item,arr,codes,code){
|
|
|
if(item){
|
|
@@ -457,99 +541,24 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- 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">
|
|
|
-
|
|
|
+.tips {
|
|
|
+ background: #409EFF;
|
|
|
+ border-radius: 50%;
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ color: #fff;
|
|
|
+ display: inline-block;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 14px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
</style>
|