|
@@ -108,90 +108,90 @@
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import asyncRequest from "@/apis/service/serviceParam/sort";
|
|
|
-import resToken from "@/mixins/resToken";
|
|
|
+import asyncRequest from '@/apis/service/serviceParam/sort'
|
|
|
+import resToken from '@/mixins/resToken'
|
|
|
export default {
|
|
|
- name: "sort",
|
|
|
- props: ["showModel", "id", "sitem"],
|
|
|
+ name: 'Sort',
|
|
|
mixins: [resToken],
|
|
|
+ props: ['showModel', 'id', 'sitem'],
|
|
|
data() {
|
|
|
const validate_order_rate = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("预算→成本毛利率不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('预算→成本毛利率不能为空!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validate_sale_rate = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("成本→售价毛利率不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('成本→售价毛利率不能为空!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validate_lower_rate = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("最低毛利率不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('最低毛利率不能为空!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
const validate_rate = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("单品修改下限毛利率不能为空!"));
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('单品修改下限毛利率不能为空!'))
|
|
|
} else {
|
|
|
- callback();
|
|
|
+ callback()
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
return {
|
|
|
loading: false,
|
|
|
showModelThis: this.showModel,
|
|
|
ruleForm: {
|
|
|
- id: "",
|
|
|
- cat_name: "",
|
|
|
- order_rate: "0",
|
|
|
- sale_rate: "0",
|
|
|
- lower_rate: "0",
|
|
|
- rate: "0",
|
|
|
+ id: '',
|
|
|
+ cat_name: '',
|
|
|
+ order_rate: '0',
|
|
|
+ sale_rate: '0',
|
|
|
+ lower_rate: '0',
|
|
|
+ rate: '0'
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- fund_code: "",
|
|
|
- order_rate: [{ required: true, validator: validate_order_rate, trigger: "blur" }],
|
|
|
- sale_rate: [{ required: true, validator: validate_sale_rate, trigger: "blur" }],
|
|
|
- lower_rate: [{ required: true, validator: validate_lower_rate, trigger: "blur" }],
|
|
|
- rate: [{ required: true, validator: validate_rate, trigger: "blur" }],
|
|
|
- },
|
|
|
- };
|
|
|
+ fund_code: '',
|
|
|
+ order_rate: [{ required: true, validator: validate_order_rate, trigger: 'blur' }],
|
|
|
+ sale_rate: [{ required: true, validator: validate_sale_rate, trigger: 'blur' }],
|
|
|
+ lower_rate: [{ required: true, validator: validate_lower_rate, trigger: 'blur' }],
|
|
|
+ rate: [{ required: true, validator: validate_rate, trigger: 'blur' }]
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
- showModel: function (val) {
|
|
|
- this.showModelThis = val;
|
|
|
+ showModel: function(val) {
|
|
|
+ this.showModelThis = val
|
|
|
if (val) {
|
|
|
- this.initForm();
|
|
|
+ this.initForm()
|
|
|
}
|
|
|
},
|
|
|
showModelThis(val) {
|
|
|
if (!val) {
|
|
|
- this.$emit("cancel");
|
|
|
+ this.$emit('cancel')
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
async initForm() {
|
|
|
- this.loading = true;
|
|
|
- this.rulesThis = this.rules;
|
|
|
- await this.resetForm();
|
|
|
- await this.initData();
|
|
|
- this.loading = false;
|
|
|
+ this.loading = true
|
|
|
+ this.rulesThis = this.rules
|
|
|
+ await this.resetForm()
|
|
|
+ await this.initData()
|
|
|
+ this.loading = false
|
|
|
},
|
|
|
|
|
|
async resetForm() {
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
- this.$refs.ruleForm.clearValidate();
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.$refs.ruleForm.clearValidate()
|
|
|
const {
|
|
|
pid,
|
|
|
id,
|
|
@@ -200,60 +200,60 @@ export default {
|
|
|
sale_rate,
|
|
|
lower_rate,
|
|
|
rate,
|
|
|
- fund_code,
|
|
|
- } = this.sitem;
|
|
|
+ fund_code
|
|
|
+ } = this.sitem
|
|
|
this.ruleForm = {
|
|
|
- pid: pid || "",
|
|
|
- id: id || "",
|
|
|
- cat_name: cat_name || "",
|
|
|
- fund_code: fund_code || "",
|
|
|
- order_rate: order_rate || "0",
|
|
|
- sale_rate: sale_rate || "0",
|
|
|
- lower_rate: lower_rate || "0",
|
|
|
- rate: rate || "0",
|
|
|
- };
|
|
|
+ pid: pid || '',
|
|
|
+ id: id || '',
|
|
|
+ cat_name: cat_name || '',
|
|
|
+ fund_code: fund_code || '',
|
|
|
+ order_rate: order_rate || '0',
|
|
|
+ sale_rate: sale_rate || '0',
|
|
|
+ lower_rate: lower_rate || '0',
|
|
|
+ rate: rate || '0'
|
|
|
+ }
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
order_rate_change(e) {
|
|
|
- this.ruleForm.order_rate = e + "";
|
|
|
- this.$refs.ruleForm.validateField("order_rate");
|
|
|
+ this.ruleForm.order_rate = e + ''
|
|
|
+ this.$refs.ruleForm.validateField('order_rate')
|
|
|
},
|
|
|
sale_rate_change(e) {
|
|
|
- this.ruleForm.sale_rate = e + "";
|
|
|
- this.$refs.ruleForm.validateField("sale_rate");
|
|
|
+ this.ruleForm.sale_rate = e + ''
|
|
|
+ this.$refs.ruleForm.validateField('sale_rate')
|
|
|
},
|
|
|
lower_rate_change(e) {
|
|
|
- this.ruleForm.lower_rate = e + "";
|
|
|
- this.$refs.ruleForm.validateField("lower_rate");
|
|
|
+ this.ruleForm.lower_rate = e + ''
|
|
|
+ this.$refs.ruleForm.validateField('lower_rate')
|
|
|
},
|
|
|
rate_change(e) {
|
|
|
- this.ruleForm.rate = e + "";
|
|
|
- this.$refs.ruleForm.validateField("rate");
|
|
|
+ this.ruleForm.rate = e + ''
|
|
|
+ this.$refs.ruleForm.validateField('rate')
|
|
|
},
|
|
|
|
|
|
async initData() {
|
|
|
- const res = await asyncRequest.detail({ id: this.sitem.id });
|
|
|
+ const res = await asyncRequest.detail({ id: this.sitem.id })
|
|
|
if (res && res.code === 0 && res.data) {
|
|
|
- console.log(res.data);
|
|
|
- const { pid, id, cat_name, order_rate, sale_rate, lower_rate, rate } = res.data;
|
|
|
+ console.log(res.data)
|
|
|
+ const { pid, id, cat_name, order_rate, sale_rate, lower_rate, rate } = res.data
|
|
|
this.ruleForm = {
|
|
|
- pid: pid || "",
|
|
|
- id: id || "",
|
|
|
- cat_name: cat_name || "",
|
|
|
- order_rate: order_rate || "0",
|
|
|
- sale_rate: sale_rate || "0",
|
|
|
- lower_rate: lower_rate || "0",
|
|
|
- rate: rate || "0",
|
|
|
- };
|
|
|
+ pid: pid || '',
|
|
|
+ id: id || '',
|
|
|
+ cat_name: cat_name || '',
|
|
|
+ order_rate: order_rate || '0',
|
|
|
+ sale_rate: sale_rate || '0',
|
|
|
+ lower_rate: lower_rate || '0',
|
|
|
+ rate: rate || '0'
|
|
|
+ }
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
+ await this.logout()
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ this.$message.warning(res.message)
|
|
|
}
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|