<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase.php');?>
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/css/jquery.autocomplete.css">
<div class="main_auto">
	<div style="width:700px;">
		<div class="BgMenu"><span>零件基本信息</span></div>
		<form method="post" action="<?php echo mvc::$cfg['ADMIN_URI'];?>part/PartAddOk" onsubmit="return CheckPartBasic()" id="PartAddForm">
			<input type="hidden" name="PartId" id="PartId" value="0"/>
			<table class="table table-bordered table-hover">
				<tr>
					<th class="right" width="100px">零件名称：</th>
					<td><input class="form-control" type="text" name="base[part_name]" id="partName"/></td>
				</tr>
				<tr>
					<th class="right"><span Helper="010_001"></span>关键字：</th>
					<td>
						<textarea class="form-control" name="base[part_keyword]" rows="5" cols="70" onchange="STRING.toKeyword(this)"></textarea>
						<div style="float:right;">
							<div id="logoBox" class="picture-wrap">
								<?php if(!empty($PartArr['part_img'])){ ?>
									<a href="<?php echo LibFc::ImgRoute([$PartArr['part_img'],100],'logo');?>" target="_blank" title="点击查看大图">
										<img id="logoImg" src="<?php echo LibFc::ImgRoute([$PartArr['part_img']],'logo');?>"/>
									</a>
									<input type="hidden" name="base[part_img]" id='logoVal' value="<?php echo $PartArr['part_img'];?>"/>
								<?php }else{ ?>
									<img id="logoImg" onclick="clickBlank(this)" src="<?php echo mvc::$cfg['ADMIN_STATIC_URL'].'images/web-upload-addImg.png';?>"/>
									<input type="hidden" name="base[part_img]" id='logoVal' value=""/>
								<?php } ?>
							</div>
						</div>		
					</td>
				</tr>
				<tr>
					<th class="right">虚拟分类：</th>
					<td>
						<label><input name="base[part_virtual]" value="1" type="radio"> 是</label>&nbsp;&nbsp;&nbsp;&nbsp;
						<label><input name="base[part_virtual]" value="0" checked type="radio"> 否</label>
					</td>
				</tr>
				<tr>
					<th class="right">末级分类：</th>
					<td>
						<label><input name="base[part_is_end]" value="1" type="radio"> 是</label>&nbsp;&nbsp;&nbsp;&nbsp;
						<label><input name="base[part_is_end]" value="0" checked type="radio"> 否</label>
					</td>
				</tr>
				<tr>
					<th class="right">
					目录绑定厂商：
					<div class="center"><a href="<?php echo mvc::$cfg['ADMIN_URI'];?>part/tcdsup" target="_blank" class="a_blue">厂商列表</a></div>
					</th>
					<td><textarea class="form-control" rows="3" name="base[part_sup_names]" cols="90" onchange="STRING.toKeyword(this)" placeholder="如:TRW,ATE 多个逗号分隔"><?php echo $PartArr['part_sup_names'];?></textarea></td>
				</tr>
				<tr>
					<th class="right">
					目录绑定零件：
					<div class="center"><a href="<?php echo mvc::$cfg['ADMIN_URI'];?>part/tcdsup" target="_blank" class="a_blue">零件列表</a></div>
					</th>
					<td><textarea class="form-control" rows="3" name="base[part_opart_names]" cols="90" onchange="STRING.toKeyword(this)" placeholder="如:刹车片,刹车片(前) 多个逗号分隔"><?php echo $PartArr['part_opart_names'];?></textarea></td>
				</tr>
				<tr>
					<th class="right">目录车型：</th>
					<td>
						<?php foreach($partModelFiled as $filed=>$fname){?>
						<label><input type="checkbox" name="model_fileds[]" <?php if($PartArr['part_model_fileds'] && in_array($filed, $PartArr['part_model_fileds'])) echo ' checked';?> value="<?php echo $filed;?>"><?php echo $fname;?></label>&nbsp;&nbsp;&nbsp;&nbsp;
						<?php }?>
					</td>
				</tr>
				<tr>
					<th class="right">关系树：</th>
					<td>
						<table class="table table-bordered" id="PartParentList">
							<tr class="success">
								<td colspan="3">
									<input type="text" class="form-control" id="TempPartParent" size="75" value="<?php echo $pPartName;?>" />
									<input type="button" class="btn btn-default btn-info" value="添加父级" onclick="AddPartParent()"/>
								</td>
							</tr>
							<tr class="success">
								<th>父级</th>
								<th width="60px">主关系</th>
								<th width="40px">操作</th>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center" ><input class="btn btn-default btn-primary" type="submit" value="保存基本信息"/></td>
				</tr>
			</table>
		</form>
	</div>
</div>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footBase.php');?>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/part.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/jquery.autocomplete.js"></script>
<script type="text/javascript">
var AutoPartArr = <?php echo json_encode($AutoPartArr);?>;
$(function() {
	//父级自动完成
	$("#TempPartParent").autocomplete(AutoPartArr, {
		minChars: 0,
		max: 500,
		matchContains : true,
		formatItem: function(row) {
			return row.name;
		},
		formatMatch: function(row) {
			return row.name;
		},
		formatResult: function(row) {
			return row.name;
		}
	});
	if($.trim($('#TempPartParent').val())!==''){
		AddPartParent();
	}
	//分类标识
	PartLogo.initUpload('logo','shopLogo');
});

var DesId = 0;

</script>