<!DOCTYPE html>
<html>
<head>
    <title>分销层级，树状层级，每个子级只有唯一一个父级，一个父级可以多个子级</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.distHierName" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-col span="4">
                    <i-select v-model="q.pdistId" placeholder="一级分销商"  >
                        <i-option v-for="dist in queryMkDistList" :value="dist.distId" :key="dist.distId">{{dist.distName}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("mkdisthier:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("mkdisthier:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("mkdisthier:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
		<i-form ref="formValidate" :model="mkDistHier" :rules="ruleValidate" :label-width="130">
            <Form-item label="分销渠道" prop="distChnlId">
                <i-select v-model="mkDistHier.distChnlId" placeholder="分销渠道" label-in-value @on-change="changeDist">
                    <i-option v-for="mkDistChnl in mkDistChnlList" :value="mkDistChnl.distChnlId" :key="mkDistChnl.distChnlId">{{mkDistChnl.distFlag}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="上级分销商" prop="pdistId">
                <!--<i-input v-model="mkDistHier.pdistId" placeholder="上级分销商id"/>-->
                <i-select v-model="mkDistHier.pdistId" placeholder="上级分销商" label-in-value v-show="!isOperatorShow">
                    <i-option v-for="mkDist in mkDistList" :value="mkDist.distId" :key="mkDist.distId">{{mkDist.distName}}
                    </i-option>
                </i-select>
                <i-select v-model="mkDistHier.pdistId" placeholder="上级分销商" label-in-value v-show="isOperatorShow" disabled>
                    <i-option v-for="mkDist in mkUpDistList" :value="mkDist.distId" :key="mkDist.distId">{{mkDist.distName}}
                    </i-option>
                </i-select>

            </Form-item>
            <Form-item label="子级分销商" prop="distId">
                <!--<i-input v-model="mkDistHier.distId" placeholder="分销商id"/>-->
                <i-select v-model="mkDistHier.distId" placeholder="分销商" label-in-value >
                    <i-option v-for="mkDist in mkDistList" :value="mkDist.distId" :key="mkDist.distId">{{mkDist.distName}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="分销层级名称" prop="distHierName">
                <i-input v-model="mkDistHier.distHierName" placeholder="分销层级名称"/>
            </Form-item>
            <Form-item label="分销层级昵称" prop="distHierNname">
                <i-input v-model="mkDistHier.distHierNname" placeholder="分销层级昵称"/>
            </Form-item>
            <Form-item label="层级级别" prop="hierLvl">
                <i-select v-model="mkDistHier.hierLvl" placeholder="层级级别" style="width: 268px;" v-show="!isOperatorShow">
                    <i-option v-for="lvl in lvlEntitieyList" :value="lvl.hierLvl" :key="lvl.hierLvl">{{lvl.hierKey}}
                    </i-option>
                </i-select>
                <i-select v-model="mkDistHier.hierLvl" placeholder="层级级别" style="width: 268px;" label-in-value v-show="isOperatorShow" disabled>
                    <i-option v-for="lvl in lvlEntitieyList" :value="lvl.hierLvl" :key="lvl.hierLvl">{{lvl.hierKey}}
                    </i-option>
                </i-select>
                <!--<i-select v-model="mkDistHier.hierLvl" placeholder="层级级别" style="width: 268px;" v-show="isOperatorShow" disabled>-->
                    <!--<i-option v-for="lvl in lvlEntitieyList" :value="lvl.hierLvl" :key="lvl.hierLvl">{{lvl.hierKey}}-->
                    <!--</i-option>-->
                <!--</i-select>-->
                <!--<i-select v-model="mkDistHier.hierLvl" placeholder="层级级别" style="width: 268px;" v-show="!isOperatorShow">-->
                    <!--<i-option v-for="lvl in lvlEntitieyList" :value="lvl.hierLvl" :key="lvl.hierLvl">{{lvl.hierKey}}-->
                    <!--</i-option>-->
                <!--</i-select>-->
            </Form-item>
            <Form-item label="所属供应商" prop="supplierId">
                <i-select v-model="mkDistHier.supplierId" placeholder="所属供应商" style="width: 268px;">
                    <i-option v-for="supplier in suppliers" :value="supplier.id" :key="supplier.id">{{supplier.childSupplierName}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="排序" prop="sortOrder">
                <i-input v-model="mkDistHier.sortOrder" placeholder="排序"/>
            </Form-item>
            <Form-item label="是否有效" prop="isValid">
                <Radio-group v-model="mkDistHier.isValid">
                    <Radio label="1">
                        <span>无效</span>
                    </Radio>
                    <Radio label="0">
                        <span>有效</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Form-item label="备注" prop="note">
                <i-input v-model="mkDistHier.note" placeholder="备注"/>
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
	</Card>
</div>

<script src="${rc.contextPath}/js/mk/mkdisthier.js?_${date.systemTime}"></script>
</body>
</html>