<template>
	<div>
		<el-form ref="form" label-width="80px">
			<el-form-item label="停业">
				<ImageRightUpload @callback="submit" v-model="list['closeDown']" :limit="1" />       
			</el-form-item>
			<el-form-item label="制作中">
				<ImageRightUpload @callback="submit" v-model="list['inProduction']" :limit="1"/>       
			</el-form-item>
			<el-form-item label="有待取单">
				<ImageRightUpload @callback="submit" v-model="list['thereAOrder']" :limit="1" />       
			</el-form-item>
			<el-form-item label="无待取单">
				<ImageRightUpload @callback="submit" v-model="list['noOrder']" :limit="1"/>     
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
import { updateConfig } from '@/api/system/config';

export default {
	props: ['initValue'],
	watch: {
		initValue(val) {
			if (val.configValue) {
				this.list = JSON.parse(val.configValue)
			}

		}
	},
	data() {
		return {
			list: {}
		}
	},
	methods: {
		submit() {
			this.$nextTick(() => {
				console.log(this.list);
				updateConfig({ ...this.initValue, configValue: JSON.stringify(this.list) }).then(res => {
					this.$modal.msgSuccess("修改成功");
				})
			})
		}
	}
}
</script>

<style>
</style>