<div ms-controller="ProductStorage">
    <table border="0" align="center" cellpadding="0" cellspacing="0" id="mian">
        <tbody>
            <tr>
                <!--leftNav-->
                <td width="198" height="450" valign="top" id="tdleft" style="border-bottom: #d2d2d2 1px solid;">
                    <div id="left" ms-widget="leftMenu,productStorageMenu">
                    </div>
                    <!--End leftNav-->
                </td>
                <td width="10">&nbsp;</td>
                <td valign="top" bgcolor="#FFFFFF" height="1" style="vertical-align: top; width: 198px;">
                    <table cellpadding="0" cellspacing="0" height="100%" class="bordergrag top10">
                        <tr>
                            <td style="vertical-align: top;">
                                <div class="boxTitlenoneb">
                                    <h2>
                                        <a href="javascript:void(0)" class="setico" ms-click="typeManage" style="float: right;" title="仓库类别管理"></a>
                                        仓库类别
                                    </h2>
                                    <ul id="storageTypeTree" class='ztree' ms-widget="productCategoryTree,storageTypeTree,storageTypeTreeOpts" style="width: 198px; overflow: auto;"></ul>
                                    <br>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="10">&nbsp;</td>
                <td valign="top" style="padding-right:5px;">
                    <div class="boxTitlenob top10">
                        <h2>仓库管理
                            <span class="rseachbox">
                                <input class="input" type="text" ms-duplex="queryData.keyword.val" placeholder="请输入仓库名称、编号" ms-keyup="onEnter">
                                <button type="button" class="inputbt" ms-click="doSearch"></button>
                            </span>
                        </h2>
                    </div>
                    <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10" id="tableList" style="margin-bottom: 1px;">
                        <thead>
                            <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="8">
                                    <a ms-if="ADD" class="doadd" href="javascript:void(0)" data-permission="ADD" ms-click="doadd">{{lang.AddBtn}}</a>
                                    <a ms-if="DELETE" data-permission="DELETE" href="javascript:void(0)" class="doalldel" ms-click="doRemoveAll" ms-attr-title="{{lang.BtachDelBtn}}">{{lang.BtachDelBtn}}</a>
                                </td>
                            </tr>
                            <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                                <td width="2%" align="center">
                                    <input type="checkbox" ms-duplex-radio="grid1.checkall">
                                </td>
                                <td width="10%" align="center">编号
                                </td>
                                <td width="30%" align="center">名称
                                </td>
                                <td width="14%" align="center">拼音简码
                                </td>
                                <td width="20%" align="center">类别
                                </td>
                                <td width="8%" align="center">形态
                                </td>
                                <td width="8%" align="center">状态
                                </td>
                                <td width="10%" align="center">{{lang.Operate}}
                                </td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr align="center" ms-repeat-item="grid1.list">
                                <td>
                                    <input type="checkbox" ms-duplex-radio="item.checked">
                                </td>
                                <td align="left">
                                    <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.No}}</a>
                                </td>
                                <td align="left">
                                    <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.Name|truncate(15,"...")}}</a>
                                </td>
                                <td align="left">
                                    {{item.NameLetter}}
                                </td>
                                <td align="left">
                                    {{item.TypeName}}
                                </td>
                                <td align="center">{{item.Form==0?"实体仓":"虚拟仓"}}
                                </td>
                                <td align="center">
                                    <a ms-if="item.State==1" href="javascript:void(0)" ms-click="updateState(item,0)" class="statebtn enabled">已启用</a>
                                    <a ms-if="item.State==0" href="javascript:void(0)" ms-click="updateState(item,1)" class="statebtn disabled">已禁用</a>
                                </td>
                                <td>
                                    <a ms-attr-title="lang.ViewBtn" href="javascript:void(0)" ms-click="doview(item.Id)" class="doview"></a>
                                    <a ms-if="item.EDIT" ms-attr-title="lang.EditBtn" href="javascript:void(0)" ms-click="doedit(item.Id)" class="doedit"></a>
                                    <a ms-if="!item.EDIT" ms-attr-title="lang.EditBtn" href="javascript:void(0)" class="noedit"></a>
                                    <a ms-if="item.DELETE" ms-attr-title="lang.DelBtn" href="javascript:void(0)" ms-click="doRemove(item)" class="dodel" ms-attr-index="$index"></a>
                                    <a ms-if="!item.DELETE" ms-attr-title="lang.DelBtn" href="javascript:void(0)" class="nodel"></a>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="8" ms-widget='paging' data-gridid="grid1"></td>
                            </tr>
                        </tfoot>
                    </table>

                </td>
            </tr>
        </tbody>
    </table>

    <!--新增和编辑-->
    <noscript id="formTemplate">
        <div class="tabContent2">
            <table width="98%" cellspacing="2" cellpadding="0" border="0" class="commontable">
                <tbody>
                    <tr>
                        <th style="width:80px;">仓库类别：
                        </th>
                        <td style="width:278px;">
                            <select ms-duplex-text="entity.TypeId">
                                <option value="">请选择</option>
                                <option ms-repeat-r="types" ms-value="r.Id" ms-text="r.Data"></option>
                            </select>
                            <span class="must">*</span>
                        </td>
                        <th style="width:80px;">仓库形态：
                        </th>
                        <td>
                            <label><input type="radio" value="0" ms-duplex-text="entity.Form" />实体仓库</label>
                            <label><input type="radio" value="1" ms-duplex-text="entity.Form" />虚拟仓库</label>
                        </td>
                    </tr>
                    <tr>
                        <th>仓库编号：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.No" style="width:117px;"><span class="must" style="margin-left:8px;">*</span>
                        </td>
                        <th>状态：
                        </th>
                        <td>
                            <label><input type="radio" value="1" ms-duplex-text="entity.State" />已启用</label>
                            <label style="margin-left:18px;"><input type="radio" value="0" ms-duplex-text="entity.State" />已禁用</label>
                        </td>
                    </tr>
                    <tr>
                        <th>仓库名称：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.Name" id="storageName" style="width:117px;"><span class="must" style="margin-left:8px;">*</span>
                        </td>
                        <th>拼音简码：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.NameLetter" style="width:100px;" />
                            <a href="javascript:void(0)" ms-click="onNameChange" style="color:#016b96;">生成</a>
                        </td>
                    </tr>
                    <tr>
                        <th>仓库地址：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.Address" style="width:180px;" />
                            <button class="myfbt" type="button" ms-click='markInMap'>
                            <i class="imark"></i>地图标注</button>
                        </td>
                        <th>联系电话：
                        </th>
                        <td>
                            <input type="text" ms-duplex="entity.Tel" style="width:100px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>备注：
                        </th>
                        <td colspan="3">
                            <input type="text" ms-duplex="entity.Remark" style="width:462px;" />
                        </td>
                    </tr>
                    <tr>
                        <th>启用多仓位：
                        </th>
                        <td colspan="3">
                           <input type="checkbox" ms-duplex-radio="entity.MultipleSpace" />
                        </td>
                    </tr>
                </tbody>
            </table>
            <table ms-if="entity.MultipleSpace" width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td width="40%" align="center" bgcolor="#FFFFFF">
                    仓位编号
                </td>
                <td width="50%" align="center" bgcolor="#FFFFFF">仓位名称
                </td>
                <td width="10%" align="center" bgcolor="#FFFFFF">操作
                </td>
            </tr>
            <tbody>
                <tr ms-repeat-item="spaceList">
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.No" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.Name" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF" style="text-align:center;">
                        <a ms-if="!$first" title="删除" href="javascript:void(0)" ms-click="removeSpace($index)" class="dodel"></a>
                        <a ms-if="$first" title="第一条不能删除" href="javascript:void(0)" class="nodel"></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <a href="javascript:void(0)" ms-click="addSpace">+&nbsp;新增一行</a>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>

    <!--查看-->
    <noscript id="viewTemplate">
        <div  class="tabContent2">
            <table width="98%" cellspacing="1" cellpadding="2" border="0" class="tablecInfo">
                <tbody>
                    <tr>
                        <td style="width:90px;">仓库类别
                        </td>
                        <td>
                            {{entity.TypeName}}
                        </td>
                        <td style="width:90px;">仓库形态
                        </td>
                        <td>
                            {{entity.Form?"虚拟仓库":"实体仓库"}}
                        </td>
                    </tr>
                    <tr>
                        <td>仓库编号
                        </td>
                        <td>
                            {{entity.No}}
                        </td>
                        <td>状态
                        </td>
                        <td>
                            <span ms-click="updateState(entity,entity.State==1?0:1)" class="statebtn hand" ms-class-1="{{entity.State==1?'enabled':'disabled'}}">
                                {{entity.State==1?"已启用":"已禁用"}}</span>
                        </td>
                    </tr>
                    <tr>
                        <td>仓库名称
                        </td>
                        <td>
                            {{entity.Name}}
                        </td>
                        <td>拼音简码
                        </td>
                        <td>
                            {{entity.NameLetter}}
                        </td>
                    </tr>
                    <tr>
                        <td>仓库地址
                        </td>
                        <td>
                            {{entity.Address}}
                        </td>
                        <td>联系电话
                        </td>
                        <td>
                            {{entity.Tel}}
                        </td>
                    </tr>
                    <tr>
                        <td>备注
                        </td>
                        <td colspan="3">
                            {{entity.Remark}}
                        </td>
                    </tr>
                    <tr>
                        <td>是否启用多仓位
                        </td>
                        <td colspan="3">
                            {{entity.MultipleSpace?"已启用":"未启用"}}
                        </td>
                    </tr>
                </tbody>
            </table>
            <table ms-if="entity.MultipleSpace" width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td width="40%" align="center" bgcolor="#FFFFFF">
                    仓位编号
                </td>
                <td width="60%" align="center" bgcolor="#FFFFFF">仓位名称
                </td>
            </tr>
            <tbody>
                <tr ms-repeat-item="spaceList">
                    <td align="center" bgcolor="#FFFFFF">
                        {{item.No}}
                    </td>
                    <td bgcolor="#FFFFFF">
                        {{item.Name}}
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>

    <!--分类-->
    <noscript id="typeTmpl">
        <div class="tabContent2" style="width:600px;">
            <table width="98%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10">
            <tr class="head">
                <td width="60%" align="center" bgcolor="#FFFFFF">
                    名称
                </td>
                <td width="30%" align="center" bgcolor="#FFFFFF">排序
                </td>
                <td width="10%" align="center" bgcolor="#FFFFFF">操作
                </td>
            </tr>
            <tbody>
                <tr ms-repeat-item="typeList">
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.Data" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF">
                        <input type="text" ms-duplex="item.Sort" style="width:90%;margin-bottom:3px;text-align:center;">
                    </td>
                    <td bgcolor="#FFFFFF" style="text-align:center;">
                        <a ms-if="!$first" title="删除" href="javascript:void(0)" ms-click="removeType($index)" class="dodel"></a>
                        <a ms-if="$first" title="第一条不能删除" href="javascript:void(0)" class="nodel"></a>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        <a href="javascript:void(0)" ms-click="addType">+&nbsp;新增一行</a>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
    </noscript>
</div>
