<template>
	<el-container>
		<el-main>
			<el-card header="计算系数" shadow="hover">
				<el-form>
					<el-form-item label="料号系数">
						<el-input-number
							v-model="form.enm_lhxs"
							controls-position="right"
							placeholder="料号系数"
						></el-input-number>
					</el-form-item>

					<el-form-item style="float: right">
						<el-button
							type="primary"
							:loading="saveLoading"
							@click="submitForm"
							>保存</el-button
						>
					</el-form-item>
				</el-form>
			</el-card>
		</el-main>
	</el-container>
</template>
<script>
export default {
	data() {
		return {
			saveLoading: false,
			form: {
				enm_lhxs: "",
			},
		};
	},
	mounted() {
		this.getSysConfig();
	},
	methods: {
		getSysConfig() {
			this.$API.system.config.getInfo.req().then((res) => {
				this.form = res.enm;
			});
		},
		submitForm() {
			this.saveLoading = true;
			this.$API.system.config.updateInfo
				.req(this.form)
				.then((res) => {
					this.saveLoading = false;
				})
				.catch((res) => {
					this.saveLoading = false;
				});
		},
	},
};
</script>
