import {
	SET_FORM_TABLE_DATA,
	SHOW_TREE,
	TABLE_TREE_ID
} from '@/store/mutation-types'
// import Vue from 'vue'

const formTable = {
	state: {
		tableTata: [
			{
				type: 'attrs',
				label: '序号',
				span: 24,
				display: true,
				move: false,
				prop: 'sort_' + Date.now()
			}
		],
		showTree: false,
		table_tree_id: '',
		options: {
			column: [
				{
					type: 'tree',
					label: '',
					span: 8,
					display: true,
					dicData: [],
					parent: true,
					cascaderItem: [],
					props: { label: 'label', value: 'value' },
					prop: 'a16424135317574993'
				},
				{
					type: 'dynamic',
					label: '子表单',
					span: 16,
					display: true,
					children: {
						align: 'center',
						headerAlign: 'center',
						index: false,
						addBtn: true,
						delBtn: true,
						column: [
							{
								type: 'attrs',
								label: '序号',
								span: 24,
								display: true,
								prop: 'sort_' + Date.now()
							}
						]
					},
					prop: '1642398752094_92175'
				}
			],
			labelPosition: 'left',
			labelSuffix: '：',
			labelWidth: 100,
			gutter: 0,
			menuBtn: true,
			submitBtn: true,
			submitText: '提交',
			emptyBtn: true,
			emptyText: '清空',
			menuPosition: 'center'
		}
	},
	mutations: {
		[SET_FORM_TABLE_DATA]: (state, val) => {
			state.tableTata = val
		},
		[SHOW_TREE]: (state, val) => {
			state.showTree = val
		},
		[TABLE_TREE_ID]: (state, val) => {
			state.table_tree_id = val
		}
	},
	actions: {
		setTableData({ commit }, val) {
			commit(SET_FORM_TABLE_DATA, val)
		},
		setShowTree({ commit }, val) {
			commit(SHOW_TREE, val)
		},
		setTableTreeId({ commit }, val) {
			commit(TABLE_TREE_ID, val)
		}
	}
}
export default formTable
