|
@@ -52,15 +52,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 编辑添加分类 -->
|
|
|
- <el-dialog :title="class_type == 'add' ? '添加规则分类' : '编辑规则分类'" :visible.sync="class_show" :close-on-click-modal="false" width="500px">
|
|
|
+ <el-dialog :title="class_type == 'add' ? '添加规则分类' : '编辑规则分类'" :visible.sync="class_show" @close="add_dept_close('dept_formdata')" :close-on-click-modal="false" width="500px">
|
|
|
<el-form :model="dept_formdata" ref="dept_formdata" :rules="dept_formdata_rules" label-width="80px">
|
|
|
<el-form-item label="规则分类" prop="name"><el-input v-model="dept_formdata.name"></el-input></el-form-item>
|
|
|
<el-form-item label="上级分类">
|
|
|
<el-cascader
|
|
|
+ ref="dept"
|
|
|
v-model="dept_formdata.pid"
|
|
|
:options="rule_tree"
|
|
|
:props="{ checkStrictly: true, label: 'name', value: 'id', children: 'child' }"
|
|
|
clearable
|
|
|
+ filterable
|
|
|
></el-cascader>
|
|
|
</el-form-item>
|
|
|
<div class="flex-box">
|
|
@@ -86,11 +88,13 @@
|
|
|
v-show="rule_tree !== null && rule_tree.length == 0"
|
|
|
></div>
|
|
|
<el-cascader
|
|
|
+ ref="dept2"
|
|
|
placeholder="请选择分类"
|
|
|
v-model="rules_detail_form.rule_id"
|
|
|
- @visible-change="select_rule"
|
|
|
:options="rule_tree"
|
|
|
:props="{ checkStrictly: true, label: 'name', value: 'id', children: 'child' }"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
></el-cascader>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
@@ -105,31 +109,23 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<div class="flex-box flex-v-ce">
|
|
|
- <el-form-item prop="min_point" class="select_width">
|
|
|
- <el-input
|
|
|
- placeholder="请输入分值"
|
|
|
- v-model.number="rules_detail_form.min_point"
|
|
|
- type="age" class="input-with-select"
|
|
|
- >
|
|
|
+ <el-form-item prop="min_point2" class="select_width">
|
|
|
+ <el-input placeholder="请输入分值" v-model.number="rules_detail_form.min_point2" type="age" class="input-with-select">
|
|
|
<el-select v-model="integral_select_name1" slot="prepend" placeholder="请选择类型">
|
|
|
<el-option v-for="(item, index) in integral_select" :key="index" :label="item.name" :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<div v-if="rules_detail_form.range_type == 2" style="position: relative;bottom: 10px;padding: 0 10px;">至</div>
|
|
|
- <el-form-item prop="max_point" v-if="rules_detail_form.range_type == 2" class="form-right select_width">
|
|
|
- <el-input
|
|
|
- placeholder="请输入分值"
|
|
|
- v-model.number="rules_detail_form.max_point"
|
|
|
- type="age" class="input-with-select"
|
|
|
- >
|
|
|
+ <el-form-item prop="max_point2" v-if="rules_detail_form.range_type == 2" class="form-right select_width">
|
|
|
+ <el-input placeholder="请输入分值" v-model.number="rules_detail_form.max_point2" type="age" class="input-with-select">
|
|
|
<el-select v-model="integral_select_name2" slot="prepend" placeholder="请选择类型">
|
|
|
<el-option v-for="(item, index) in integral_select" :key="index" :label="item.name" :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
-<!-- <el-form-item prop="min_point">
|
|
|
+<!-- <el-form-item prop="min_point">
|
|
|
<el-row :gutter="20" class="select_width">
|
|
|
<el-col :span="11">
|
|
|
<el-input
|
|
@@ -211,8 +207,8 @@ import noData from '@/components/noData';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- action:process.env.VUE_APP_BASE_API+'/api/rule/import',
|
|
|
- downloadUrl:'https://ding.insys.g107.com/file/template.xlsx',
|
|
|
+ action:process.env.VUE_APP_BASE_API+'api/rule/import',
|
|
|
+ downloadUrl:process.env.VUE_APP_BASE_API+'api/download/rule_item',
|
|
|
ATOKEN: { 'A-TOKEN': this.$getToken(),'Accept':'application/vnd.test.v2+json' },
|
|
|
tips_show: true,
|
|
|
rule_loading: false,
|
|
@@ -260,8 +256,10 @@ export default {
|
|
|
rule_id: '',
|
|
|
range_type: '1',
|
|
|
prize_type: '0',
|
|
|
- min_point: '',
|
|
|
- max_point: '',
|
|
|
+ min_point: 0,
|
|
|
+ max_point: 0,
|
|
|
+ min_point2: 0,
|
|
|
+ max_point2: 0,
|
|
|
remark: '',
|
|
|
is_attendance: '0',
|
|
|
cycle_type: '1',
|
|
@@ -282,8 +280,8 @@ export default {
|
|
|
trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
- min_point:[{ required: true, message: '分值不能为空'},{ pattern: /^[1-9]\d*$/, message: '分值必须为数字值'}],
|
|
|
- max_point:[{ required: true, message: '分值不能为空'},{ pattern: /^[1-9]\d*$/, message: '分值必须为数字值'}],
|
|
|
+ // min_point2:[{ required: true, message: '分值不能为空'},{ pattern: /^[1-9]\d*$/, message: '分值必须为数字值'}],
|
|
|
+ // max_point2:[{ required: true, message: '分值不能为空'},{ pattern: /^[1-9]\d*$/, message: '分值必须为数字值'}],
|
|
|
},
|
|
|
integral_select_name1: '1',
|
|
|
integral_select_name2: '1',
|
|
@@ -320,6 +318,18 @@ export default {
|
|
|
components: {
|
|
|
noData
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ 'dept_formdata.pid'(val, old_val) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.dept.dropDownVisible = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 'rules_detail_form.rule_id'(val, old_val) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.dept2.dropDownVisible = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
this.point_types = this.$getTyps().reverse()
|
|
|
},
|
|
@@ -418,6 +428,13 @@ export default {
|
|
|
let self = this;
|
|
|
self.$refs[form].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ if(self.rules_detail_form.min_point2==0||!self.rules_detail_form.min_point2){
|
|
|
+ this.$message.error('请输入积分分值');
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ self.rules_detail_form.min_point=self.rules_detail_form.min_point2;
|
|
|
+ self.rules_detail_form.max_point=self.rules_detail_form.max_point2;
|
|
|
if (self.integral_select_name1 != '1' && self.rules_detail_form.min_point >= 0) {
|
|
|
self.rules_detail_form.min_point = '-' + self.rules_detail_form.min_point;
|
|
|
}
|
|
@@ -427,6 +444,9 @@ export default {
|
|
|
if (self.rules_detail_form.range_type == 1) {
|
|
|
self.rules_detail_form.max_point = self.rules_detail_form.min_point;
|
|
|
}
|
|
|
+ if(Array.isArray(self.rules_detail_form.rule_id)){
|
|
|
+ self.rules_detail_form.rule_id=self.rules_detail_form.rule_id[self.rules_detail_form.rule_id.length-1];
|
|
|
+ }
|
|
|
if (parseFloat(self.rules_detail_form.min_point) > parseFloat(self.rules_detail_form.max_point)) {
|
|
|
this.$confirm(
|
|
|
'填写的规则积分是' +
|
|
@@ -499,6 +519,8 @@ export default {
|
|
|
let self = this;
|
|
|
self.$refs[form].validate(valid => {
|
|
|
if (valid) {
|
|
|
+ self.rules_detail_form.min_point=self.rules_detail_form.min_point2;
|
|
|
+ self.rules_detail_form.max_point=self.rules_detail_form.max_point2;
|
|
|
if (self.integral_select_name1 != '1' && self.rules_detail_form.min_point >= 0) {
|
|
|
self.rules_detail_form.min_point = '-' + self.rules_detail_form.min_point;
|
|
|
}
|
|
@@ -508,18 +530,17 @@ export default {
|
|
|
if (self.rules_detail_form.range_type == 1) {
|
|
|
self.rules_detail_form.max_point = self.rules_detail_form.min_point;
|
|
|
}
|
|
|
+ if(self.rules_detail_form.min_point==0||!self.rules_detail_form.min_point||self.rules_detail_form.max_point==0||!self.rules_detail_form.max_point){
|
|
|
+ this.$message.error('请输入积分分值');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(Array.isArray(self.rules_detail_form.rule_id)){
|
|
|
+ self.rules_detail_form.rule_id=self.rules_detail_form.rule_id[self.rules_detail_form.rule_id.length-1];
|
|
|
+ }
|
|
|
if (parseFloat(self.rules_detail_form.min_point) > parseFloat(self.rules_detail_form.max_point)) {
|
|
|
this.$confirm(
|
|
|
- '填写的规则积分是' +
|
|
|
- self.rules_detail_form.min_point +
|
|
|
- ' ~ ' +
|
|
|
- self.rules_detail_form.max_point +
|
|
|
- ',应该是 ' +
|
|
|
- self.rules_detail_form.max_point +
|
|
|
- ' ~ ' +
|
|
|
- self.rules_detail_form.min_point +
|
|
|
- '吧?',
|
|
|
- '提示',
|
|
|
+ '填写的规则积分是' +self.rules_detail_form.min_point +' ~ ' +self.rules_detail_form.max_point +',应该是 ' +self.rules_detail_form.max_point +
|
|
|
+ ' ~ ' +self.rules_detail_form.min_point +'吧?','提示',
|
|
|
{
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
@@ -551,6 +572,7 @@ export default {
|
|
|
} else {
|
|
|
this.rule_loading2=true;
|
|
|
self.rules_detail_form.item_id = self.rules_detail_form.id;
|
|
|
+
|
|
|
if (self.rules_detail_form.min_point == 0 && self.rules_detail_form.range_type == 1) {
|
|
|
self.$message.error('积分不能为零');
|
|
|
this.rule_loading2=false;
|
|
@@ -601,11 +623,6 @@ export default {
|
|
|
this.rule_show = false;
|
|
|
this.$refs[form].resetFields();
|
|
|
},
|
|
|
- select_rule(val) {
|
|
|
- if (!val) {
|
|
|
- this.rules_detail_form.rule_id = this.rules_detail_form.rule_id[this.rules_detail_form.rule_id.length - 1];
|
|
|
- }
|
|
|
- },
|
|
|
not_data() {
|
|
|
this.$confirm('暂时没有积分分类,是否前往添加?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
@@ -625,6 +642,8 @@ export default {
|
|
|
prize_type: '0',
|
|
|
min_point: '',
|
|
|
max_point: '',
|
|
|
+ min_point2: '',
|
|
|
+ max_point2: '',
|
|
|
remark: '',
|
|
|
is_attendance: '0',
|
|
|
cycle_type: '1',
|
|
@@ -659,6 +678,10 @@ export default {
|
|
|
|
|
|
editDetails(val) {
|
|
|
this.rules_detail_form = JSON.parse(JSON.stringify(val));
|
|
|
+
|
|
|
+ this.rules_detail_form.min_point2=this.rules_detail_form.min_point;
|
|
|
+ this.rules_detail_form.max_point2=this.rules_detail_form.max_point;
|
|
|
+
|
|
|
if (this.rules_detail_form.min_point == this.rules_detail_form.max_point) {
|
|
|
this.rules_detail_form.range_type = '1';
|
|
|
} else {
|
|
@@ -669,6 +692,7 @@ export default {
|
|
|
this.integral_select_name1 = '2';
|
|
|
let str=this.rules_detail_form.min_point;
|
|
|
this.rules_detail_form.min_point=str.toString().substring(1);
|
|
|
+ this.rules_detail_form.min_point2=str.toString().substring(1);
|
|
|
} else {
|
|
|
this.integral_select_name1 = '1';
|
|
|
}
|
|
@@ -676,6 +700,7 @@ export default {
|
|
|
this.integral_select_name2 = '2';
|
|
|
let str=this.rules_detail_form.max_point;
|
|
|
this.rules_detail_form.max_point=str.toString().substring(1);
|
|
|
+ this.rules_detail_form.max_point2=str.toString().substring(1);
|
|
|
} else {
|
|
|
this.integral_select_name2 = '1';
|
|
|
}
|
|
@@ -838,7 +863,7 @@ export default {
|
|
|
//关闭弹窗
|
|
|
add_dept_close(form) {
|
|
|
this.class_show = false;
|
|
|
- // this.$refs[form].resetFields();
|
|
|
+ this.$refs[form].resetFields();
|
|
|
},
|
|
|
//关闭提示
|
|
|
tips_close() {
|