Commit a18e00b0 by 无尘

fix: 修改下发设置

parent 76cf3757
......@@ -4,22 +4,49 @@
* @Author: 无尘
* @Date: 2020-11-09 10:05:27
* @LastEditors: 无尘
* @LastEditTime: 2020-11-09 10:22:49
* @LastEditTime: 2020-11-17 15:53:51
-->
<!-- -->
<template>
<div>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" @submit.native.prevent>
<el-form-item label="" prop="overDayJudge">
<span class="font-14 color-606266">下发时间当月,第 </span><el-input-number controls-position="right" class="w-100" v-model="ruleForm.overDayJudge" placeholder="请输入" :step="1" :step-strictly="true" :min="1" :max="99999999"></el-input-number><span class="font-14 color-606266 p-l-10"></span>
<span class="font-14 color-606266">注:如当月第28天下发,如果现在是1月份,即1月28号下发2月份指标。设置后次日生效</span>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="loadingBtn" @click="submitForm('ruleForm')">保存</el-button>
</el-form-item>
</div>
</template>
<script>
import fetch from '@/api/target-manage-app.js';
const { saveTargetSet, getTargetSet } = fetch;
import { _debounce } from '@/common/js/public';
export default {
name: 'TargetSet',
components: {},
props: {
brandId: {
type: String,
default() {
return '';
}
}
},
data() {
return {
ruleForm: {
overDayJudge: ''
},
rules: {
overDayJudge: [
{ required: true, message: '请输入', trigger: 'blur' },
]
},
loadingBtn: false
};
},
// 生命周期 - 挂载完成(访问DOM元素)
......@@ -29,9 +56,54 @@ export default {
// methods
methods: {
/**
* 保存
*/
saveSet: _debounce(function() {
const that = this;
that.loadingBtn = true;
that.postSave();
}, 300),
postSave() {
const that = this;
const para = {
overDayJudge: that.ruleForm.overDayJudge,
wxEnterpriseId: that.wxEnterpriseId
};
saveTargetSet(para)
.then(res => {
that.loadingBtn = false;
that.$message.success('保存成功');
})
.catch(function(error) {
that.loadingBtn = false;
});
},
/**
* 获取设置数据
*/
getData() {
const that = this;
const para = {
enterpriseId: that.brandId,
};
getTargetSet(para)
.then(res => {
that.ruleForm.overDayJudge = res.result.overDayJudge || '';
})
.catch(function(error) {
});
}
},
watch: {
brandId: function(newData, oldData) {
const that = this;
if (!!newData) {
that.getData();
}
}
},
watch: {}
};
</script>
<style lang='less' scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment