|
@@ -69,13 +69,13 @@
|
|
|
<el-form-item style="text-align: right; margin-bottom:0;">
|
|
|
<el-button type="danger" @click="del_dept" v-show="class_type == 'edit'">删除分类</el-button>
|
|
|
<el-button @click="add_dept_close('dept_formdata')">取消</el-button>
|
|
|
- <el-button type="primary" @click="submit_add_dept('dept_formdata')">确定</el-button>
|
|
|
+ <el-button type="primary" @click="submit_add_dept('dept_formdata')" :loading="dept_loading">确定</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 添加编辑规则 -->
|
|
|
- <el-dialog :title="rule_type == 'add' ? '添加规则' : '编辑规则'" :visible.sync="rule_show" :close-on-click-modal="false" width="700px">
|
|
|
+ <el-dialog :title="rule_type == 'add' ? '添加规则' : '编辑规则'" :visible.sync="rule_show" :close-on-click-modal="false" width="550px">
|
|
|
<el-form :model="rules_detail_form" ref="rules_detail_form" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="规则内容" prop="remark">
|
|
|
<el-input v-model="rules_detail_form.remark" placeholder="请输入规则内容" type="textarea" :rows="3"></el-input>
|
|
@@ -138,10 +138,10 @@
|
|
|
</el-row>
|
|
|
</el-form-item>
|
|
|
<el-form-item style="text-align: right; margin-bottom:0;">
|
|
|
- <el-button type="danger" @click="del_rule" v-show="rule_type == 'edit'">删除规则</el-button>
|
|
|
+ <el-button type="danger" @click="del_rule" :loading="delRule_loading" v-show="rule_type == 'edit'">删除规则</el-button>
|
|
|
<el-button @click="rule_close('rules_detail_form')">取消</el-button>
|
|
|
- <el-button type="primary" v-show="rule_type == 'add'" @click="add_submit_rule('rules_detail_form')">确定</el-button>
|
|
|
- <el-button type="primary" v-show="rule_type == 'edit'" @click="edit_submit_rule('rules_detail_form')">确定</el-button>
|
|
|
+ <el-button type="primary" v-show="rule_type == 'add'" :loading="rule_loading2" @click="add_submit_rule('rules_detail_form')">确定</el-button>
|
|
|
+ <el-button type="primary" v-show="rule_type == 'edit'" :loading="rule_loading2" @click="edit_submit_rule('rules_detail_form')">确定</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
@@ -206,6 +206,7 @@ export default {
|
|
|
selectItem: { name: '积分分类' }, //选择的分类
|
|
|
//添加分类
|
|
|
class_show: false,
|
|
|
+ delRule_loading:false,
|
|
|
dept_formdata_rules: {
|
|
|
name: [
|
|
|
{
|
|
@@ -227,9 +228,11 @@ export default {
|
|
|
cycle_type: '1'
|
|
|
},
|
|
|
class_type: 'add',
|
|
|
+ dept_loading:false,
|
|
|
|
|
|
// 规则相关
|
|
|
del_item_id: [], //选择规则ID集合
|
|
|
+ rule_loading2: false,
|
|
|
rule_type: 'add',
|
|
|
rule_show: false,
|
|
|
rules_detail_form: {
|
|
@@ -329,6 +332,7 @@ export default {
|
|
|
// 导入相关
|
|
|
close_import() {
|
|
|
this.import_rules_show = false;
|
|
|
+ this.import_btn_show = false;
|
|
|
this.$refs.upload.clearFiles();
|
|
|
},
|
|
|
submitUpload() {
|
|
@@ -336,18 +340,15 @@ export default {
|
|
|
let params = {
|
|
|
file: this.file
|
|
|
};
|
|
|
- this.$axios
|
|
|
- .post('/api/rule/import', params)
|
|
|
- .then(res => {
|
|
|
+ this.$axios.post('/api/rule/import', params).then(res => {
|
|
|
if (res.data.code == 1) {
|
|
|
- this.import_rules_show = false;
|
|
|
+ this.close_import();
|
|
|
this.$message.success({ message: res.data.msg });
|
|
|
this.getData();
|
|
|
} else {
|
|
|
this.$message({ type: 'error', message: res.data.msg });
|
|
|
}
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
+ }).finally(() => {
|
|
|
this.save_loading = false;
|
|
|
});
|
|
|
},
|
|
@@ -386,6 +387,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
edit_submit_rule(form) {
|
|
|
+ this.rule_loading2=true;
|
|
|
let self = this;
|
|
|
self.$refs[form].validate(valid => {
|
|
|
if (valid) {
|
|
@@ -424,11 +426,13 @@ export default {
|
|
|
data.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;
|
|
|
return false;
|
|
|
}
|
|
|
this.$axios
|
|
|
.post('/api/integral/rule/items/edit', data)
|
|
|
.then(res => {
|
|
|
+ this.rule_loading2=false;
|
|
|
if (res.data.code == 1) {
|
|
|
self.$message.success(res.data.msg);
|
|
|
self.getData();
|
|
@@ -448,11 +452,13 @@ export default {
|
|
|
data.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;
|
|
|
return false;
|
|
|
}
|
|
|
this.$axios
|
|
|
.post('/api/integral/rule/items/edit', data)
|
|
|
.then(res => {
|
|
|
+ this.rule_loading2=false;
|
|
|
if (res.data.code == 1) {
|
|
|
self.$message.success(res.data.msg);
|
|
|
self.getData();
|
|
@@ -460,18 +466,21 @@ export default {
|
|
|
} else {
|
|
|
self.$message.error(res.data.msg);
|
|
|
}
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
+ }).catch(e => {
|
|
|
self.$message.error(e.data.msg);
|
|
|
+ }).finally(() => {
|
|
|
+ this.rule_loading2 = false;
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
+ this.rule_loading2=false;
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
//添加规则
|
|
|
add_submit_rule(form) {
|
|
|
+ this.rule_loading2=true;
|
|
|
let self = this;
|
|
|
self.$refs[form].validate(valid => {
|
|
|
if (valid) {
|
|
@@ -507,6 +516,7 @@ export default {
|
|
|
self.rules_detail_form.max_point = min_point;
|
|
|
if (self.rules_detail_form.min_point == 0 && self.rules_detail_form.range_type == 1) {
|
|
|
self.$message.error('积分不能为零');
|
|
|
+ this.rule_loading2=false;
|
|
|
return false;
|
|
|
}
|
|
|
let data = {
|
|
@@ -522,15 +532,17 @@ export default {
|
|
|
} else {
|
|
|
self.$message.error(res.data.msg);
|
|
|
}
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
+ }).catch(e => {
|
|
|
self.$message.error(e.data.msg);
|
|
|
+ }).finally(() => {
|
|
|
+ this.rule_loading2 = false;
|
|
|
});
|
|
|
});
|
|
|
} else {
|
|
|
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;
|
|
|
return false;
|
|
|
}
|
|
|
let data = {
|
|
@@ -539,6 +551,7 @@ export default {
|
|
|
this.$axios
|
|
|
.post('/api/integral/rule/items', data)
|
|
|
.then(res => {
|
|
|
+ this.rule_loading2=false;
|
|
|
if (res.data.code == 1) {
|
|
|
self.$message.success(res.data.msg);
|
|
|
self.getData();
|
|
@@ -546,12 +559,14 @@ export default {
|
|
|
} else {
|
|
|
self.$message.error(res.data.msg);
|
|
|
}
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
+ }).catch(e => {
|
|
|
self.$message.error(e.data.msg);
|
|
|
+ }).finally(() => {
|
|
|
+ this.rule_loading2 = false;
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
+ this.rule_loading2=false;
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
@@ -562,11 +577,9 @@ export default {
|
|
|
let data = {
|
|
|
item_id: [this.rules_detail_form.id]
|
|
|
};
|
|
|
- self.$confirm('此操作将永久删除该选项, 是否继续?', '提示')
|
|
|
- .then(() => {
|
|
|
- this.$axios
|
|
|
- .post('/api/integral/rule/items/destroy', data)
|
|
|
- .then(res => {
|
|
|
+ this.delRule_loading=true;
|
|
|
+ self.$confirm('此操作将永久删除该选项, 是否继续?', '提示').then(() => {
|
|
|
+ this.$axios.post('/api/integral/rule/items/destroy', data).then(res => {
|
|
|
if (res.data.code == 1) {
|
|
|
self.$message.success(res.data.msg);
|
|
|
self.rule_show = false;
|
|
@@ -577,9 +590,10 @@ export default {
|
|
|
})
|
|
|
.catch(e => {
|
|
|
self.$message.error(e.data.msg);
|
|
|
+ }).finally(() => {
|
|
|
+ this.delRule_loading = false;
|
|
|
});
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ });
|
|
|
},
|
|
|
//关闭规则弹窗
|
|
|
rule_close(form) {
|
|
@@ -732,12 +746,13 @@ export default {
|
|
|
that.rule_tree = res.data.data.rule_tree || [];
|
|
|
that.item_list = list;
|
|
|
that.all_item_list = list;
|
|
|
- that.rule_loading = false;
|
|
|
if (is) {
|
|
|
that.handleNodeClick(that.selectItem);
|
|
|
} else {
|
|
|
this.selectItem = { name: '积分分类' }; //选择的分类
|
|
|
}
|
|
|
+ }).finally(() => {
|
|
|
+ this.rule_loading = false;
|
|
|
});
|
|
|
},
|
|
|
//编辑分组
|
|
@@ -748,6 +763,7 @@ export default {
|
|
|
},
|
|
|
//添加分组
|
|
|
submit_add_dept(form) {
|
|
|
+ this.dept_loading=true;
|
|
|
let that = this;
|
|
|
that.$refs[form].validate(valid => {
|
|
|
if (valid) {
|
|
@@ -759,10 +775,12 @@ export default {
|
|
|
if (res.data.code == 1) {
|
|
|
that.$message.success('修改积分规则成功');
|
|
|
this.getData();
|
|
|
- that.add_dept_close();
|
|
|
+ this.add_dept_close('dept_formdata');
|
|
|
} else {
|
|
|
that.$message.error(res.data.msg);
|
|
|
}
|
|
|
+ }).finally(() => {
|
|
|
+ this.dept_loading = false;
|
|
|
});
|
|
|
} else {
|
|
|
if (that.dept_formdata.pid !== null && that.dept_formdata.pid.length == 0) {
|
|
@@ -773,17 +791,20 @@ export default {
|
|
|
this.$axios.post('/api/integral/rule', that.dept_formdata).then(res => {
|
|
|
if (res.data.code == 1) {
|
|
|
this.getData();
|
|
|
- that.add_dept_close();
|
|
|
+ this.add_dept_close('dept_formdata');
|
|
|
} else {
|
|
|
that.$message.error(res.data.msg);
|
|
|
}
|
|
|
+ }).finally(() => {
|
|
|
+ this.dept_loading = false;
|
|
|
});
|
|
|
}
|
|
|
- that.class_show = false;
|
|
|
} else {
|
|
|
+ this.dept_loading=false;
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
},
|
|
|
//删除分组
|
|
|
del_dept() {
|
|
@@ -796,7 +817,7 @@ export default {
|
|
|
if (res.data.code == 1) {
|
|
|
this.$message.success(res.data.msg);
|
|
|
this.getData();
|
|
|
- this.add_dept_close();
|
|
|
+ this.add_dept_close('dept_formdata');
|
|
|
} else {
|
|
|
this.$message.error(res.data.msg);
|
|
|
}
|