<span class="el-form-control"
      v-bind:class="{text:item.type == 'text'}">
    <el-input v-if="item.type == 'input' || item.type == 'textarea'"
              v-model="item_value"
              autosize
              v-bind:clearable="item.clearable == null || item.clearable"
              v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
              v-bind:placeholder="item.placeholder != null ? item.placeholder :('请输入' + (item.label || item.name || ''))"
              v-bind:size="item.size || 'small'"
              v-bind:maxlength="item.maxlength"
              v-bind:type="item.type == 'textarea' ? 'textarea' : 'text'"
              v-bind:show-word-limit="item.maxlength > 0"
              v-bind:readonly="item.readonly == true ? 'readonly' : false">
    </el-input>
    <el-input-number v-else-if="item.type == 'number'"
                     v-model="item_value"
                     controls-position="right"
                     class="header-search header-search-input"
                     v-bind:min="item.min"
                     v-bind:clearable="item.clearable == null || item.clearable"
                     v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                     v-bind:placeholder="item.placeholder != null ? item.placeholder :('请输入' + (item.label || item.name || ''))"
                     v-bind:size="item.size || 'small'"
                     v-bind:precision="item.precision || 0">
    </el-input-number>
    <el-select v-else-if="item.type == 'select' && !item.code"
               v-model="item_value"
               v-bind:clearable="item.clearable == null || item.clearable"
               v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
               v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
               v-bind:loading="loading"
               v-bind:size="item.size || 'small'"
               v-bind:multiple="item.multiple"
               v-bind:filterable="item.filterable == null || item.filterable"
               v-on:visible-change="visibleChange($event, item)"
               v-on:change="item.change && javaScript.call(this,item.change,$event,item)">
        <el-option v-for="option in item.listOption"
                   v-bind:key="option[item.key] || option.value"
                   v-bind:label="option[item.display] || option.display"
                   v-bind:value="option[item.key] || option.value">
        </el-option>
    </el-select>
    <el-date-picker v-else-if="item.type == 'daterange'"
                    v-model="item_value"
                    value-format="yyyy/MM/dd"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    v-bind:clearable="item.clearable == null || item.clearable"
                    v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                    v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
                    v-bind:size="item.size || 'small'"
                    v-bind:type="item.type"
                    v-bind:picker-options="{shortcuts: [
                        {text: '今天',onClick:function(picker) {picker.$emit('pick', [new Date(),new Date()])}},
                        {text: '今周',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(date.setDate(date.getDate()-date.getDay()+1)),new Date(date.setDate(date.getDate()-date.getDay()+7))])}},
                        {text: '今月',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(date.setDate(1)),new Date(date.setMonth(date.getMonth() + 1) - (24 * 60 * 60 * 1000))])}},
                        {text: '上周',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(date.setDate(date.getDate()-date.getDay()+1-7)),new Date(date.setDate(date.getDate()-date.getDay()+7))])}},
                        {text: '上月',onClick:function(picker) {var date = new Date();picker.$emit('pick', [new Date(new Date(date.setMonth(new Date(date.setDate(1)).getMonth()-1))),new Date(new Date(date.setMonth(date.getMonth() + 1)).setDate(1) - (24 * 60 * 60 * 1000))])}},
                    ]}">
    </el-date-picker>
    <el-date-picker v-else-if="item.type == 'date'"
                    v-model="item_value"
                    value-format="yyyy/MM/dd"
                    v-bind:clearable="item.clearable == null || item.clearable"
                    v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                    v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
                    v-bind:size="item.size || 'small'"
                    v-bind:type="item.type"
                    v-bind:picker-options="{shortcuts: [
                        {text: '上月末',onClick:function(picker) {var date = new Date();picker.$emit('pick', new Date(date.setDate(1) - (24 * 60 * 60 * 1000)))}},
                        {text: '昨天',onClick:function(picker) {var date = new Date();picker.$emit('pick', new Date(date.setDate(date.getDate()-1)))}},
                        {text: '今天',onClick:function(picker) {picker.$emit('pick', new Date())}}
                    ]}">
    </el-date-picker>
    <el-date-picker v-else-if="item.type == 'month'"
                    v-model="item_value"
                    value-format="yyyy-MM"
                    v-bind:clearable="item.clearable == null || item.clearable"
                    v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                    v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
                    v-bind:size="item.size || 'small'"
                    v-bind:type="item.type">
    </el-date-picker>
    <el-date-picker v-else-if="item.type == 'year' || item.type == 'month'"
                    v-model="item_value"
                    v-bind:type="item.type"
                    v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                    v-bind:editable="false"
                    v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
                    v-bind:size="item.size || 'small'"
                    v-bind:value-format="item.type == 'year' ? 'yyyy' : 'MM'">
    </el-date-picker>
    <template v-else-if="item.type == 'radio'">
        <el-radio v-model="item_value"
                  v-for="option in item.listOption"
                  v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                  v-bind:key="option[item.value || 'value']"
                  v-bind:label="option[item.value || 'value']">
            {{option[item.display || 'display']}}
        </el-radio>
    </template>
    <el-switch v-else-if="item.type == 'switch'"
               v-model="item_value"
               v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))">
    </el-switch>
    <el-button v-else-if="item.type == 'button'"
               v-bind:icon="item.icon"
               v-bind:size="item.size || 'small'"
               v-bind:type="item.buttonType"
               v-bind:loading="$root.loading"
               v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
               v-on:click="($emit && $listeners && $listeners.click && $emit('click')) || javaScript.call(this,item.click)">
        {{item.name}}
    </el-button>
    <el-link v-else-if="item.type == 'a'"
             v-bind:underline="false"
             v-bind:href="item.href"
             v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
             v-on:click="$emit('click')">
        <template v-if="item.format">
            <template v-if="item.format.constructor === Boolean && (item_value.constructor === Boolean || item_value == 1 || item_value == 0)">
                {{ item_value ? '是' : '否' }}
            </template>
            <template v-else-if="item.format.constructor === String">
                <template v-if="item.format == 'money'">
                    {{ (item.precision && item.precision > 0 ? parseFloat(Math.round((item_value || 0 )*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision)) : item_value || 0).toLocaleString('zh',{minimumFractionDigits: (item.precision > 0 ? item.precision : 2)}) }}
                </template>
                <template v-else-if="item.format == 'number'">
                    {{ item.precision && item.precision > 0 ? Math.round(item_value*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision) : item_value }}
                </template>
                <template v-else-if="/[y|Y|m|M|d|h|H|s|S]+/.test(item.format)">
                    {{ new Date(item_value).format(item.format) }}
                </template>
            </template>
        </template>
        <template v-else>
            {{ item.prop ? item_value : item.name }}
        </template>
    </el-link>
    <el-image v-else-if="item.type == 'image'" 
              style="width: 100px; height: 100px" 
              fit="fill"
              v-bind:src="item_value">
    </el-image>
    <el-upload ref="upload" class="el-upload"
               v-else-if="item.type == 'file'"
               v-bind:action="item.action"
               v-bind:auto-upload="false"
               v-bind:show-file-list="false"
               v-bind:accept="item.accept"
               v-bind:on-change="onFileChange"
               v-bind:on-success="onSuccess"
               v-bind:on-error="onError">
        <el-button v-bind:icon="item.icon"
                   v-bind:size="item.size || 'small'"
                   v-bind:type="item.buttonType"
                   v-bind:loading="$root.loading"
                   v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))">
            {{ item.name || '浏览' }}
        </el-button>
    </el-upload>
    <el-breadcrumb v-else-if="item.type == 'breadcrumb'"
                   v-bind:size="item.size || 'small'"
                   separator-class="el-icon-arrow-right">
        <el-breadcrumb-item v-bind:size="item.size || 'small'">
            首页
        </el-breadcrumb-item>
        <el-breadcrumb-item v-for="(crumb,index) in item_value"
                            v-bind:key="index"
                            v-bind:size="item.size || 'small'"
                            v-bind:class="{mt59:(index > 1 && (index % 2 == 0))}">
            <el-input v-model="item_value[index]"
                      autosize
                      v-bind:clearable="item.clearable == null || item.clearable"
                      v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
                      v-bind:placeholder="item.placeholder != null ? item.placeholder :('请选择' + (item.label || item.name || ''))"
                      v-bind:maxlength="item.maxlength"
                      v-bind:show-word-limit="item.maxlength > 0"
                      v-bind:size="item.size || 'small'">
            </el-input>
            <el-button icon="el-icon-close"
                       v-bind:size="item.size || 'small'"
                       v-on:click="item_value.splice(index, 1)">
            </el-button>
        </el-breadcrumb-item>
        <el-breadcrumb-item v-if="!item_value || !item_value.length || !!item_value[item_value.length - 1]"
                            v-bind:size="item.size || 'small'">
            <el-button icon="el-icon-plus"
                       v-bind:size="item.size || 'small'"
                       v-on:click="item_value == null ? setArrayValue('') : item_value.push('')">
            </el-button>
        </el-breadcrumb-item>
    </el-breadcrumb>
    <template v-else-if="item.type == 'table' && item.code">
        <el-button v-if="!item_value || !item_value.length"
                   type="success"
                   icon="el-icon-plus"
                   v-bind:size="item.size || 'small'"
                   v-on:click="setArrayValue({sortable: true})">
            {{"新增"}}
        </el-button>
        <el-table-control ref="table"
                          v-else
                          v-bind:code="item.code"
                          v-model="item_value"
                          v-on:show-dialog="showDialog">
        </el-table-control>
    </template>
    <template v-else-if="item.color">
        <span class="text" v-bind:style="'color:' +  item.color">{{item_value}}</span>
    </template>
    <template v-else-if="item_value != null">
        <template v-if="item.format">
            <template v-if="item.format.constructor === Boolean && (item_value.constructor === Boolean || item_value == 1 || item_value == 0)">
                {{ item_value ? '是' : '否' }}
            </template>
            <template v-else-if="item.format.constructor === String">
                <template v-if="item.format == 'money'">
                    {{ (item.precision && item.precision > 0 ? parseFloat(Math.round(item_value*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision)) : item_value).toLocaleString('zh',{minimumFractionDigits: (item.precision > 0 ? item.precision : 2)}) }}
                </template>
                <template v-else-if="item.format == 'number'">
                    {{ item.precision && item.precision > 0 ? Math.round(item_value*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision) : item_value }}
                </template>
                <template v-else-if="/[y|Y|m|M|d|h|H|s|S]+/.test(item.format)">
                    {{ new Date(item_value).format(item.format) }}
                </template>
            </template>
        </template>
        <template v-else>
            {{ item_value }}
        </template>
    </template>
</span>
</script>
<script type="text/x-template" id="elTableControl">
    @Html.PartialAsync("~/Areas/Component/Views/Table/Control.cshtml").Result
</script>
<script src="@Url.Content("~/js/component/el-form-control.js")" type="text/javascript">