import store  from '@/store';
import { genWarehouseAuthSearchModal,genBldgSearchModal,genContainerSearchModal } from  '@/views/kzyWMS/SearchModal';
const grid = {span:12, labelCol: { span: 8 }};

const  items_warehous = function(_this){
	let warehouseId = store.state.user.warehouse.warehouseId;
	return (
		[
			// 仓库
			...genWarehouseAuthSearchModal(1, true, false,null, 
					function (rowData, form) {
						if (!rowData) {
							// form.setFieldsValue({
							// 	warehouseId: '',
							// 	warehouseCode:'',
							// 	warehouseName:''
							// })
						} else {
							warehouseId = rowData[0].companyId
							// form.setFieldsValue({
							// 	warehouseId: rowData[0].warehouseId,
							// 	warehouseCode: rowData[0].warehouseCode,
							// 	warehouseName: rowData[0].warehouseName,
							// })
						}
						_this.warehouseId = warehouseId
					},
					{...grid},
				),
		// 建筑物
		...genBldgSearchModal(1, true, false,
			function(vn,p){
				p.params.warehouseId = warehouseId;
				return p;
			}, 
		function(rowData, form){
			if (!rowData) {
				form.setFieldsValue({
					bldgId: '',
					bldgCode:'',
					bldgName:''
				})
			} else {
				// 执行函数search()
				// _this.search(rowData[0]);
				_this.bldgInfo = rowData[0]
				form.setFieldsValue({
					bldgId: rowData[0].bldgId,
					bldgCode: rowData[0].bldgCode,
					bldgName: rowData[0].bldgName,
				})
			}
			
		},{...grid},
		),
	/* {name: 'type',label: '0：任务索取 1：任务确认',value: '1', hidden:true  }, 
	{type: 'input',name: 'operatorCode',label: '工号',value: '',disabled:true,...grid  },*/
	/* {
			type: 'buttonGroup',
			style: { textAlign: 'right' },
			...grid,
			options: [
			   {value: '索取',icon: 'pull-request',btnType: 'primary',style: 'margin-right:16px',htmlType: 'submit'},
			  {value: "重置",name: "ccz",icon: "redo",style: 'margin-right:16px',
			                 on: { click(event, form) {
			   											form.resetFields();
			   										},
			   									},
			   },
			   {value: '确认',btnType: 'primary',icon: 'check',style: 'margin-right:16px',
				on: {
				  click(event, form){
					  _this.confirmSave();
					}
					}
				},
			   {value: '解锁数量',btnType: 'primary',icon: 'unlock',
				on: {
				  click(event, form){
					  _this.unlock();
					}
					}
				},
		]} */
	])
}




const columns = [
	{ dataIndex:'pickOrderId', title:'拣选单号',width:80 },
	{ dataIndex:'status', title:'状态',width:80,scopedSlots:{customRender:'status'} },
	{ dataIndex:'operatorName', title:'索取人',width:120,ellipsis:true },
	{ dataIndex:'taskCount', title:'任务数',width:80,ellipsis:true},
	{ dataIndex:'gmtCreate', title:'日期',width:80,scopedSlots:{customRender:'gmtCreate'} },
	{ dataIndex:'action', title:'操作',width:80,scopedSlots:{customRender:'action'} },
];


export { columns, items_warehous }
