<template>
   <el-table-column
      v-if="!item.hide"
      :prop="item.prop"
      :label="item.label"
      :width="item.width"
      :min-width="item.minWidth || '110px'"
      :fixed="item.fixed"
      :show-overflow-tooltip="item.showOverflowTooltip"
      :sortable="item.sortable"
      :sort-method="item.sortMethod"
      :resizable="item.resizable || true"
      :align="item.align ? item.align : 'left'">
      <template slot="header" v-if="inlineSearch">
        <div v-if="item && item.prop" class="aos-table-form-inline__inline-header">
          <div :class=" { 'header-center': inlineSearch}"  class="aos-table-form-inline__inline-header-label">
            {{ item.label }}
          </div>
          <div class="aos-table-form-inline__inline-header-body">
            <template v-if="!item.hideInlineSearch && ((item.searchType ? item.searchType : item.type) === 'input' || !item.type)">
              <inline-input
                :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'"
                :placeholder="'请输入' + item.label"
                :value="(item.searchProp ? copySearchData[item.searchProp] : copySearchData[item.prop])"
                @change="function(data) {handleInlineSearchChange(data, item)}">
              </inline-input>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'defdoc'">
              <aos-defdoc
                :placeholder="'请选择'+item.label"
                :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'"
                :value="item.searchProp ? (copySearchData[item.searchProp] || '') : (copySearchData[item.prop] || '')"
                :editable="true"
                :defCode="item.defCode"
                :tag="item.tag"
                :customerUrl="item.customerUrl"
                :multiple="item.multiple"
                :no-def-code="item.noDefCode"
                :orm-code="item.ormCode"
                :orm-name="item.ormName"
                :orm-status="item.ormStatus"
                :orm-data="item.ormData"
                :outer="item.outer"
                :outer-options="item.outerOptions"
                @change="function(data) { handleInlineSearchChange(data, item)}">
              </aos-defdoc>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'ref'">
              <aos-ref
                :placeholder="'请选择'+item.label"
                :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'"
                :value="item.searchProp ? (copySearchData[item.searchProp] || '') : (copySearchData[item.prop] || '')"
                :editable="true"
                :refCode="item.refCode"
                :multiple="item.multiple"
                :filters="item.filters"
                @change="function(data) { handleInlineSearchChange(data, item)}">
              </aos-ref>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'date'">
              <inline-date :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'" :value="item.searchProp ? copySearchData[item.searchProp] : copySearchData[item.prop]" :format="item.format" :type="item.searchType || 'date'" @end="function(data) { handleInlineSearchChange(data, item)}"></inline-date>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'number-range'">
              <inline-number-range :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'" :value="item.searchProp ? copySearchData[item.searchProp] : copySearchData[item.prop]" :precision="item.precision" @change="function(data) { handleInlineSearchChange(data, item)}"></inline-number-range>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'money'">
              <inline-number-range :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'" :value="item.searchProp ? copySearchData[item.searchProp] : copySearchData[item.prop]" :precision="item.precision || 2" @change="function(data) { handleInlineSearchChange(data, item)}"></inline-number-range>
            </template>
            <template v-if="!item.hideInlineSearch && (item.searchType ? item.searchType : item.type) === 'number'">
              <el-input-number :ref="(item.searchProp ? item.searchProp : item.prop) + '-inline-search'" :value="item.searchProp ? copySearchData[item.searchProp] : copySearchData[item.prop]" :step="item.step" step-strictly @change="function(data) { handleInlineSearchChange(data, item)}"></el-input-number>
            </template>
          </div>
        </div>
      </template>
      <template slot-scope="scope" >
        <slot v-if="item.showSlot" :name="item.prop + '-slot'" :scope="scope"></slot>
        <template v-if="item.type === 'input' || '' || undefined">
          <el-input
            :ref="item.prop + '-ref'"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :style="{width: (item.attrs && item.attrs.width) || ''}"
            v-model.trim="scope.row[item.prop]"
            :type="(item.attrs && item.attrs.type) || 'text'"
            :minlength="(item.attrs && item.attrs.minlength) || 0"
            :maxlength="(item.attrs && item.attrs.maxlength) || 10000"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请在此输入'"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :show-word-limit="(item.attrs && item.attrs.showWordLimit) || false"
            :show-password="(item.attrs && item.attrs.showPassword) || false"
            :readonly="(item.attrs && item.attrs.readonly)"
            :max="(item.attrs && item.attrs.max)"
            :min="(item.attrs && item.attrs.min)"
            :step="(item.attrs && item.attrs.step)"
            :resize="(item.attrs && item.attrs.resize)"
            :autofocus="(item.attrs && item.attrs.autofocus) || false"
            :validate-event="(item.attrs && item.attrs.validateEvent) || true"
            :text-align="(item.attrs && item.attrs.textAlign) || 'left'"
            @blur="formHandleEmit(item,'blur')"
            @change="formHandleEmit(item,'change')"
            @input="formHandleEmit(item,'input')"
            @focus="formHandleEmit(item,'focus')"
            @clear="formHandleEmit(item,'clear')"
          >
          <template v-if="item.attrs && (item.attrs.suffixString || item.attrs.buttonString || item.attrs.secondButtonString || item.attrs.countTime || item.attrs.icon || item.attrs.ocrType)">
            <div slot="append">
              <div class="aos-form-input-append" v-if="item.attrs.suffixString" @click="formHandleEmit(item,'suffix')">
                {{item.attrs.suffixString ? item.attrs.suffixString : ''}}
              </div>
              <span style="cursor: pointer;" :style="{'margin-left':item.attrs.suffixString ? '8px' : '0px', 'color': (item.attrs && item.attrs.iconActive) ? '#409EFF' : '#909399'}" type="primary" v-if="item.attrs.icon" :title="item.attrs.iconTitle" @click="formHandleEmit(item,'icon')">
                <i :class="'el-icon-' + item.attrs.icon"></i>
              </span>
              <span style="color:#409EFF;cursor: pointer;" :style="{'margin-left':item.attrs.icon ? '8px' : '0px'}" :title="item.attrs.buttonString" type="primary" v-if="item.attrs.buttonString" @click="formHandleEmit(item,'button')">
                {{item.attrs.buttonString ? item.attrs.buttonString : ''}}
              </span>
              <span style="color:#409EFF;border-left:1px solid #eee;cursor: pointer;" :title="item.attrs.secondButtonString" type="primary" v-if="item.attrs.secondButtonString" @click="formHandleEmit(item,'second-button')">
                {{item.attrs.secondButtonString ? item.attrs.secondButtonString : ''}}
              </span>
              <aos-count-time 
                v-if="item.attrs.countTime"
                :ref="item.prop + '-count-time-ref'"
                @click="formHandleEmit(item,'count-time')"
                :time="item.attrs.countTime.time" 
                :count-name="item.attrs.countTime.countName"
                :default-name="item.attrs.countTime.defaultName"
                :disabled="item.attrs.countTime.disabled"
                :auto-count="item.attrs.countTime.autoCount">
              </aos-count-time>
              <el-upload
                v-if="item.attrs && item.attrs.ocrType"
                :action="'/cmbiz/api/ocr/'+ocrObject[item.attrs.ocrType]"
                :data="data"
                :disabled="!edit"
                :show-file-list="false"
                :on-preview="(response, file, fileList) => {handleInlineOcr(item,'preview',response, file, fileList)}"
                :on-remove="(response, file, fileList) => {handleInlineOcr(item,'remove',response, file, fileList)}"
                :on-error="(response, file, fileList) => {handleInlineOcr(item,'error',response, file, fileList)}"
                :on-success="(response, file, fileList) => {handleInlineOcr(item,'success',response, file, fileList)}">
                <div slot="trigger">
                  <el-button v-if="item.attrs.ocrType" :disabled="!edit" icon="el-icon-camera"></el-button>
                </div>
              </el-upload>
            </div>
          </template>
          </el-input>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">
              {{scope.row[item.prop]}}
              <span style="margin-left: 8px;" v-if="item.attrs && item.attrs.suffixString">{{item.attrs.suffixString}}</span>
              <span style="margin-left: 8px;" v-if="item.viewSlot">
                <slot :name="item.prop+'-view-slot'" :scope="scope.row"></slot>
              </span>
            </div>
          </div>
        </template>
        <template v-if="item.type == 'textarea'">
          <el-input
            :ref="item.prop + '-ref'"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :title="scope.row[item.prop]"
            v-model="scope.row[item.prop]"
            type="textarea"
            style="width: 100%"
            :style="{width: (item.attrs && item.attrs.width) || ''}"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :minlength="(item.attrs && item.attrs.minlength) || 0"
            :maxlength="(item.attrs && item.attrs.maxlength) || 10000"
            :rows="(item.attrs && item.attrs.rows) || 4"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请在此输入'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :autosize="(item.attrs && item.attrs.autosize) || false"
            @blur="formHandleEmit(item,'blur')"
            @change="formHandleEmit(item,'change')"
            @focus="formHandleEmit(item,'focus')"
            @clear="formHandleEmit(item,'clear')"
          ></el-input>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">{{scope.row[item.prop]}}</div>
          </div>
        </template>
        <template v-if="item.type == 'select'">
          <el-select 
            :ref="item.prop + '-ref'"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请在此输入'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :multiple="(item.attrs && item.attrs.multiple) || false"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :collapse-tags="(item.attrs && item.attrs['collapse-tags']) || false"
            :multiple-limit="(item.attrs && item.attrs['multiple-limit']) || 0"
            :filterable="(item.attrs && item.attrs.filterable) || false"
            :allow-create="(item.attrs && item.attrs['allow-create']) || false"
            :filter-method="(item.attrs && item.attrs['filter-method']) || function(){}"
            :remote="(item.attrs && item.attrs.remote) || false"
            :remote-method="(item.attrs && item.attrs['remote-method']) || function(){}"
            :loading="(item.attrs && item.attrs.loading) || false"
            :no-match-text="(item.attrs && item.attrs['no-match-text']) || '无匹配数据'"
            :no-data-text="(item.attrs && item.attrs['no-data-text']) || '无数据'"
            :reserve-keyword="(item.attrs && item.attrs['reserve-keyword']) || false"
            :default-first-option="(item.attrs && item.attrs['default-first-option']) || false"
            :popper-append-to-body="(item.attrs && item.attrs['popper-append-to-body']) || true"
            @change="formHandleEmit(item,'change')"
            @visible-change="formHandleEmit(item,'visible-change')"
            @remove-tag="formHandleEmit(item,'remove-tag')"
            @clear="formHandleEmit(item,'clear')"
            @blur="formHandleEmit(item,'blur')"
            @focus="formHandleEmit(item,'focus')">
            <el-option
              v-for="item in item.option"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              :disabled="item.disabled"
            ></el-option>
          </el-select>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div>{{getSelectLabel(item, scope.row[item.prop])}}</div>
          </div>
        </template>
        <template v-if="item.type == 'time-picker'">
          <el-time-picker
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :readonly="(item.attrs && item.attrs.readonly) || false"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :editable="(item.attrs && item.attrs.editable) || true"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请选择时间'"
            :is-range="(item.attrs && item.attrs['is-range']) || false"
            :arrow-control="(item.attrs && item.attrs['arrow-control']) || false"
            :start-placeholder="(item.attrs && item.attrs['start-placeholder']) || '开始时间'"
            :end-placeholder="(item.attrs && item.attrs['end-placeholder']) || '结束时间'"
            :align="(item.attrs && item.attrs.align) || 'left'"
            :picker-options="(item.attrs && item.attrs['picker-options']) || {format: 'HH:mm:ss'}"
            :range-separator="(item.attrs && item.attrs['range-separator']) || '-'"
            :value-format="(item.attrs && item.attrs['value-format']) || 'HH:mm:ss'"
            :prefix-icon="(item.attrs && item.attrs['prefix-icon']) || 'el-icon-time'"
            :clear-icon="(item.attrs && item.attrs['clear-icon']) || 'el-icon-circle-close'"
            @change="formHandleEmit(item,'change')"
            @blur="formHandleEmit(item,'blur')"
            @focus="formHandleEmit(item,'focus')"
            >
          </el-time-picker>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">{{scope.row[item.prop]}}</div>
          </div>
        </template>
        <template v-if="item.type == 'time-select'">
          <el-time-select
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :readonly="(item.attrs && item.attrs.readonly) || false"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :editable="(item.attrs && item.attrs.editable) || true"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请选择时间'"
            :start-placeholder="(item.attrs && item.attrs['start-placeholder']) || '开始时间'"
            :end-placeholder="(item.attrs && item.attrs['end-placeholder']) || '结束时间'"
            :align="(item.attrs && item.attrs.align) || 'left'"
            :picker-options="(item.attrs && item.attrs['picker-options']) || {start: '08:00',step: '00:15',end: '18:30'}"
            :range-separator="(item.attrs && item.attrs['range-separator']) || '-'"
            :prefix-icon="(item.attrs && item.attrs['prefix-icon']) || 'el-icon-time'"
            :clear-icon="(item.attrs && item.attrs['clear-icon']) || 'el-icon-circle-close'"
            @change="formHandleEmit(item,'change')"
            @blur="formHandleEmit(item,'blur')"
            @focus="formHandleEmit(item,'focus')"
            >
          </el-time-select>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">{{scope.row[item.prop]}}</div>
          </div>
        </template>
        <template v-if="item.type == 'date-picker'">
          <el-date-picker
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :readonly="(item.attrs && item.attrs.readonly) || false"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :editable="(item.attrs && item.attrs.editable) || true"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请选择日期'"
            :start-placeholder="(item.attrs && item.attrs['start-placeholder']) ||'开始日期'"
            :end-placeholder="(item.attrs && item.attrs['end-placeholder']) || '结束日期'"
            :type="(item.attrs && item.attrs.type) || 'date'"
            :format="(item.attrs && item.attrs.format) || 'yyyy-MM-dd'"
            :align="(item.attrs && item.attrs.align) || 'left'"
            :range-separator="(item.attrs && item.attrs['range-separator']) || '-'"
            :picker-options="(item.attrs && item.attrs['picker-options'])"
            :value-format="((item) => {
              var valueFormat = item.attrs && item.attrs['value-format']
              if (valueFormat) {
                if (valueFormat === 'date') {
                  return ''
                } else {
                  return valueFormat
                }
              } else {
                return 'yyyy-MM-dd'
              }
            })(item)"
            :unlink-panels="(item.attrs && item.attrs['unlink-panels']) || false"
            :validate-event="(item.attrs && item.attrs['validate-event']) || true"
            :prefix-icon="(item.attrs && item.attrs['prefix-icon']) || 'el-icon-date'"
            :clear-icon="(item.attrs && item.attrs['clear-icon']) || 'el-icon-circle-close'"
            @change="formHandleEmit(item,'change')"
            @blur="formHandleEmit(item,'blur')"
            @focus="formHandleEmit(item,'focus')"
            >
          </el-date-picker>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">{{formatDatePickerValue(scope.row[item.prop],item)}}</div>
          </div>
        </template>
        <template v-if="item.type == 'switch'">
          <el-switch
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :width="(item.attrs && item.attrs.width) || 40"
            :active-text="(item.attrs && item.attrs['active-text']) || ''"
            :inactive-text="(item.attrs && item.attrs['inactive-text']) || ''"
            :active-value="(item.attrs && item.attrs['active-value']) || true"
            :inactive-value="(item.attrs && (item.attrs['inactive-value'] || item.attrs['inactive-value'] === 0)) ? item.attrs['inactive-value'] : false"
            :active-color="(item.attrs && item.attrs['active-color']) || '#409EFF'"
            :inactive-color="(item.attrs && item.attrs['inactive-color']) || '#C0CCDA'"
            :name="(item.attrs && item.attrs.name) || item.prop"
            :validate-event	="(item.attrs && item.attrs['validate-event']) || true"
            @change="formHandleEmit(item,'change')"
            >
          </el-switch>
          <div class="el-form-item__content" v-else>
            <el-switch
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            :disabled="true"
            :width="(item.attrs && item.attrs.width) || 40"
            :active-text="(item.attrs && item.attrs['active-text']) || ''"
            :inactive-text="(item.attrs && item.attrs['inactive-text']) || ''"
            :active-value="(item.attrs && item.attrs['active-value']) || true"
            :inactive-value="(item.attrs && (item.attrs['inactive-value'] || item.attrs['inactive-value'] === 0)) ? item.attrs['inactive-value'] : false"
            :active-color="(item.attrs && item.attrs['active-color']) || '#409EFF'"
            :inactive-color="(item.attrs && item.attrs['inactive-color']) || '#C0CCDA'"
            :name="(item.attrs && item.attrs.name) || item.prop"
            >
          </el-switch>
          </div>
        </template>
        <template v-if="item.type == 'radio'">
          <el-radio-group
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            @change="formHandleEmit(item,'change')"
            >
            <el-radio v-for="option in item.option" :key="option.label" :label="option.label">{{option.label}}</el-radio>
          </el-radio-group>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]">{{scope.row[item.prop]}}</div>
          </div>
        </template>
        <template v-if="item.type == 'color-picker'">
          <el-color-picker
            :ref="item.prop + '-ref'"
            v-model="scope.row[item.prop]"
            :title="scope.row[item.prop]"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :show-alpha="(item.attrs && item.attrs['show-alpha']) || false"
            :color-format="(item.attrs && item.attrs['color-format']) || 'hex'"
            :predefine="(item.attrs && item.attrs.predefine) || null"
            @change="formHandleEmit(item,'change')"
            @active-change="formHandleEmit(item,'active-change')"
            >
          </el-color-picker>
          <div class="el-form-item__content aos-form-input-text" v-else>
            <div :title="scope.row[item.prop]" :style="'background-color:'+scope.row[item.prop]">{{scope.row[item.prop]}}</div>
          </div>
        </template>
        <template v-if="item.type == 'ref'">
          <aos-ref
            :ref="item.prop + '-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :value="scope.row[item.prop] || ''"
            :refCode="item.attrs.refCode"
            :queryParams="item.attrs.queryParams"
            :filters="item.attrs.filters"
            :debounce="item.attrs.debounce || 300"
            :placeholder="item.attrs.placeholder || '请输入'"
            :disabled="item.attrs.disabled || false"
            :firstDefault="item.attrs.firstDefault || false"
            :multiple="item.attrs.multiple || false"
            :multipleLimit="item.attrs.multipleLimit || 0"
            :placement="item.attrs.placement || 'bottom-start'"
            :appendIcon="item.attrs.appendIcon || false"
            :show-type="item.attrs && item.attrs.showType"
            @change="function(data, emitFullData){handleRefEmit(data,item,'change', emitFullData)}"
            @clear="function(data){handleRefEmit(data,item,'clear')}"
            @blur="function(data){handleRefEmit(data,item,'blur')}"
            @focus="function(data){handleRefEmit(data,item,'focus')}"
            @visible-change="function(data){handleRefEmit(data,item,'visible-change')}"
            @remove-tag="function(data){handleRefEmit(data,item,'remove-tag')}"
            @plus-click="function(data){handleRefEmit(data,item,'plus-click')}"
            >
          </aos-ref>
        </template>
        <template v-if="item.type == 'ref-lease'">
          <aos-ref-lease
            :value="scope.row[item.prop]"
            :ref="item.prop + '-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :baseUrl="item.attrs.baseUrl"
            :refUrl="item.attrs.refUrl"
            :field="item.attrs.field"
            :multiple="item.attrs.multiple"
            :collapseTags="item.attrs.collapseTags"
            :debounce="item.attrs.debounce || 300"
            :placeholder="item.attrs.placeholder || '选择'"
            :disabled="item.attrs.disabled || false"
            :placement="item.attrs.placement || 'bottom-start'"
            :queryParams="item.attrs.queryParams"
            @select="function(data){handleRefLeaseEmit(data,item,'select',index)}"
            @visible-change="function (data) {handleRefLeaseEmit(data,item,'visible-change',index)}"
            @remove-tag="function (tag) {handleRefLeaseEmit(data,item,'remove-tag',index)}"
            @clear="function (data) {handleRefLeaseEmit(data,item,'clear',index)}"
            @blur="function (data) {handleRefLeaseEmit(data,item,'blur',index)}"
            @focus="function (data) {handleRefLeaseEmit(data,item,'focus',index)}"
            >
          </aos-ref-lease>
        </template>
        <template v-if="item.type == 'defdoc'">
          <aos-defdoc
            :ref="item.prop + '-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :value="scope.row[item.prop] || ''"
            :defCode="item.attrs.defCode"
            :tag="item.attrs.tag || ''"
            :multiple="item.attrs.multiple || false"
            :debounce="item.attrs.debounce || 300"
            :firstDefault="item.attrs.firstDefault || false"
            :collapseTags="item.attrs.collapseTags || false"
            :placeholder="item.attrs.placeholder || '请选择'"
            :disabled="item.attrs.disabled || false"
            :orm-code="item.attrs.ormCode"
            :no-def-code="item.attrs.noDefCode"
            :orm-name="item.attrs.ormName"
            :orm-status="item.attrs.ormStatus"
            :orm-data="item.attrs.ormData"
            :customerUrl="item.attrs.customerUrl"
            :show-type="item.attrs && item.attrs.showType"
            :outer="item.attrs && item.attrs.outer"
            :outer-options="item.attrs && item.attrs.outerOptions"
            @change="function(data, emitFullData){handleDefdocEmit(data,item,'change',emitFullData)}"
            @visible-change="function(data){handleDefdocEmit(data,item,'visible-change')}"
            @remove-tag="function(data){handleDefdocEmit(data,item,'remove-tag')}"
            @clear="function(data){handleDefdocEmit(data,item,'clear')}"
            @blur="function(data){handleDefdocEmit(data,item,'blur')}"
            @focus="function(data){handleDefdocEmit(data,item,'focus')}"
            >
          </aos-defdoc>
        </template>
        <template v-if="item.type == 'remote-select'">
          <aos-select
            :ref="item.prop + '-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :value="scope.row[item.prop] || ''"
            :url="item.attrs.url"
            :multiple="item.attrs.multiple || false"
            :debounce="item.attrs.debounce || 300"
            :firstDefault="item.attrs.firstDefault || false"
            :collapseTags="item.attrs.collapseTags || false"
            :placeholder="item.attrs.placeholder || '请选择'"
            :disabled="item.attrs.disabled || false"
            @change="function(data){handleDefdocEmit(data,item,'change')}"
            @visible-change="function(data){handleDefdocEmit(data,item,'visible-change')}"
            @remove-tag="function(data){handleDefdocEmit(data,item,'remove-tag')}"
            @clear="function(data){handleDefdocEmit(data,item,'clear')}"
            @blur="function(data){handleDefdocEmit(data,item,'blur')}"
            @focus="function(data){handleDefdocEmit(data,item,'focus')}"
            >
          </aos-select>
        </template>
        <template v-if="item.type == 'defdoc-lease'">
          <aos-defdoc-lease
            :value="scope.row[item.prop]"
            :ref="item.prop + '-defdoc-lease'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :field="item.prop"
            :baseUrl="item.attrs.baseUrl"
            :defCode="item.attrs.defCode"
            :debounce="item.attrs.debounce || 300"
            :placeholder="item.attrs.placeholder || '请选择'"
            :disabled="item.attrs.disabled || false"
            @change="function(data){handleDefdocEmit(data,item,'change')}"
            @visible-change="function(data){handleDefdocEmit(data,item,'visible-change')}"
            @remove-tag="function(data){handleDefdocEmit(data,item,'remove-tag')}"
            @clear="function(data){handleDefdocEmit(data,item,'clear')}"
            @blur="function(data){handleDefdocEmit(data,item,'blur')}"
            @focus="function(data){handleDefdocEmit(data,item,'focus')}"
            >
          </aos-defdoc-lease>
        </template>
        <template v-if="item.type == 'rule-defdoc'">
          <aos-rule-defdoc
            :ref="item.prop + '-rule-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :value="scope.row[item.prop] || ''"
            :field="item.prop"
            :defCode="item.attrs.defCode"
            :multiple="item.attrs.multiple || false"
            :debounce="item.attrs.debounce || 300"
            :firstDefault="item.attrs.firstDefault || false"
            :collapseTags="item.attrs.collapseTags || false"
            :placeholder="item.attrs.placeholder || '请选择'"
            :disabled="item.attrs.disabled || false"
            @change="function(data){handleDefdocEmit(data,item,'change')}"
            @visible-change="function(data){handleDefdocEmit(data,item,'visible-change')}"
            @remove-tag="function(data){handleDefdocEmit(data,item,'remove-tag')}"
            @clear="function(data){handleDefdocEmit(data,item,'clear')}"
            @blur="function(data){handleDefdocEmit(data,item,'blur')}"
            @focus="function(data){handleDefdocEmit(data,item,'focus')}"
            >
          </aos-rule-defdoc>
        </template>
        <template v-if="item.type == 'money'">
          <aos-money
            :ref="item.prop + '-ref'"
            :editable="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            v-model="scope.row[item.prop]"
            :minlength="(item.attrs && item.attrs.minlength) || 0"
            :maxlength="(item.attrs && item.attrs.maxlength) || 10000"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请在此输入'"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :size="(item.attrs && item.attrs.size) || 'small'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :debounce="(item.attrs && item.attrs.debounce) || 300"
            :suffixString="(item.attrs && item.attrs.suffixString) || ''"
            :icon="(item.attrs && item.attrs.icon) || ''"
            :icon-title="(item.attrs && item.attrs.iconTitle) || ''"
            :icon-active="(item.attrs && item.attrs.iconActive) || false"
            @change="function(data){handleMoneydocEmit(data,item,'change')}"
            @clear="function(data){handleMoneydocEmit(data,item,'clear')}"
            @blur="function(data){handleMoneydocEmit(data,item,'blur')}"
            @focus="function(data){handleMoneydocEmit(data,item,'focus')}"
            @icon-click="function(data, iconActive){handleMoneydocEmit(data,item,'icon-click', iconActive)}"
            >
          </aos-money>
        </template>
        <template v-if="item.type == 'markdown'">
          <aos-markdown
            :ref="item.prop + '-ref'"
            :edit="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :content="scope.row[item.prop]"
            @blur="function($event,value){handleMarkdownEditorEmit($event,item,value,'blur')}"
            @focus="function($event,value){handleMarkdownEditorEmit($event,item,value,'focus')}"
            @change="function($event,value){handleMarkdownEditorEmit($event,item,value,'change')}"
            @ready="function($event,value){handleMarkdownEditorEmit($event,item,value,'ready')}">
          </aos-markdown>
        </template>
        <template v-if="item.type == 'city'">
          <aos-city
            :templateValue.sync="scope.row"
            :edit="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :province="item.province" 
            :city="item.city" 
            :county="item.county"
            :separator="(item.attrs && item.attrs.separator) || '/'"
            :placehold="(item.attrs && item.attrs.placeholder) || '请选择省/市/县'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :clearable="(item.attrs && item.attrs.clearable) || true"
            :customerUrl="item.attrs && item.attrs.customerUrl"
            :customerMethod="item.attrs && item.attrs.customerMethod"
            @change="function(value){handleCityEmit(item,value,'change')}">
          </aos-city>
        </template>
        <template v-if="item.type == 'uploader' || item.type == 'img-upload'">
          <el-upload
            :ref="item.prop + '-ref'"
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            class="aos-uploader"
            :action="item.attrs.action"
            :multiple="item.attrs.multiple || false"
            :data="item.attrs.data || {}"
            :name="item.attrs.name || 'file'"
            :limit="item.attrs.limit"
            :on-exceed="item.attrs.onExceed"
            :show-file-list="false"
            :auto-upload="item.attrs.autoUpload"
            :http-request="(typeof item.attrs.httpRequest !== 'function') ? undefined : item.attrs.httpRequest"
            drag
            :before-upload="function(file){handleUploaderEmit(item,'before-upload',file)}"
            :before-remove="function(file,fileList){handleUploaderEmit(item,'before-remove',file,fileList)}"
            :on-success="function(response,file,fileList){handleUploaderEmit(item,'on-success',response,file,fileList)}"
            :on-remove="function(file,fileList){handleUploaderEmit(item,'on-remove',file,fileList)}"
            :on-error="function(err,file,fileList){handleUploaderEmit(item,'on-error',err,file,fileList)}"
            :on-progress="function(err,file,fileList){handleUploaderEmit(item,'on-progress',err,file,fileList)}"
            :on-preview="function(file){handleUploaderEmit(item,'on-preview',file)}"
            :on-change="function(file,fileList){handleUploaderEmit(item,'on-change',file,fileList)}"
            :disabled="item.attrs.disabled || false">
            <img v-if="item.attrs.imageUrl || scope.row[item.prop]" :src="item.attrs.imageUrl || scope.row[item.prop]" :alt="item.attrs.imageName">
            <div v-else>
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            </div>
          </el-upload>
          <div class="aos-uploader-img" v-if="!edit">
            <img :src="item.attrs.imageUrl || scope.row[item.prop]" :alt="item.attrs.imageName">
          </div>
        </template>
        <template v-if="item.type == 'upload'">
          <el-upload
            v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            class="aos-upload"
            :ref="item.prop + '-ref'"
            :action="item.attrs.action"
            :multiple="item.attrs.multiple || false"
            :data="item.attrs.data || {}"
            :name="item.attrs.name || 'file'"
            :limit="item.attrs.limit"
            :on-exceed="item.attrs.onExceed"
            :show-file-list="item.attrs.showFileList"
            :file-list="Object.prototype.toString.call(item.attrs.fileList) !== '[object Array]' ? [] : item.attrs.fileList"
            :auto-upload="item.attrs.autoUpload"
            :http-request="(typeof item.attrs.httpRequest !== 'function') ? undefined : item.attrs.httpRequest"
            :before-upload="function(file){handleUploaderEmit(item,'before-upload',file)}"
            :before-remove="function(file,fileList){handleUploaderEmit(item,'before-remove',file,fileList)}"
            :on-success="function(response,file,fileList){handleUploaderEmit(item,'on-success',response,file,fileList)}"
            :on-remove="function(file,fileList){handleUploaderEmit(item,'on-remove',file,fileList)}"
            :on-error="function(err,file,fileList){handleUploaderEmit(item,'on-error',err,file,fileList)}"
            :on-progress="function(err,file,fileList){handleUploaderEmit(item,'on-progress',err,file,fileList)}"
            :on-preview="function(file){handleUploaderEmit(item,'on-preview',file)}"
            :on-change="function(file,fileList){handleUploaderEmit(item,'on-change',file,fileList)}"
            :disabled="!edit">
            <el-button size="small" type="primary" v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)">点击上传</el-button>
          </el-upload>
        </template>
        <template v-if="item.type == 'image'">
          <aos-image
            :imageId="item.prop + '_' + item.attrs.imageId"
            :src="scope.row[item.prop]">
          </aos-image>
        </template>
        <template v-if="item.type == 'input-number'">
          <aos-input-number
            :ref="item.prop + '-ref'"
            :edit="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :title="scope.row[item.prop]"
            :value="scope.row[item.prop]"
            :min="(item.attrs && (item.attrs.min || item.attrs.min === 0)) ? item.attrs.min : -Infinity"
            :max="(item.attrs && (item.attrs.max || item.attrs.max === 0)) ? item.attrs.max : Infinity"
            :style="{width: (item.attrs && item.attrs.width) || ''}"
            :step="(item.attrs && (item.attrs.step)) || 1"
            :step-strictly="(item.attrs && item.attrs.stepStrictly) || false"
            :precision="(item.attrs && item.attrs.precision)"
            :controls="(item.attrs && item.attrs.controls) || true"
            :controls-position="(item.attrs && item.attrs.controlsPosition) || 'right'"
            :name="(item.attrs && item.attrs.name)"
            :placeholder="(item.attrs && item.attrs.placeholder) || '请在此输入'"
            :disabled="(item.attrs && item.attrs.disabled) || false"
            :autosize="(item.attrs && item.attrs.autosize) || false"
            @blur="function (event) { handleInputNumberEmit(item, 'blur', event) }"
            @change="function (currentValue, oldValue) { handleInputNumberEmit(item,'change',currentValue, oldValue,) }"
            @focus="function (event) { handleInputNumberEmit(item, 'focus', event) }"
          ></aos-input-number>
        </template>
        <template v-if="item.type == 'ocr'">
          <aos-ocr
            :ref="item.prop + '-ref'"
            :edit="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs)"
            :value="scope.row[item.prop]"
            :project-id="scope.row[item.attrs.projectId]"
            :ocr-type="item.attrs && item.attrs.ocrType"
            @success="function (data) { handleOcr(item, 'success', data) }"
            @change="function (data) { handleOcr(item,'change',data) }"
            @error="function (data) { handleOcr(item, 'error', data) }"
          ></aos-ocr>
        </template>
        <template v-if="inlineEditable(scope.row) && handleInlineEditAble(scope.row) && edit && ((item.attrs && !item.attrs.notEdit) || !item.attrs) && item.description" slot="extra">
          <el-popover
            class="aos-form-item__description"
            placement="top-start"
            :title="item.label + '说明'"
            width="200"
            trigger="hover"
            :content="item.description">
            <i class="el-icon-question" slot="reference"></i>
          </el-popover>
        </template>
        <template v-if="item.showSlot">
          <slot :name="item.prop + '-slot'"></slot>
        </template>
      </template>
    </el-table-column>
</template>

<script>
export default {
  name: 'AosTableItem',
  props: {
    item: {
      type: Object,
      required: true
    },
    edit: Boolean,
    inlineSearch: Boolean,
    inlineEditable: Function,
    handleInlineEditAble: Function,
    handleRefEmit: Function,
    formHandleEmit: Function,
    handleInlineSearchChange: Function,
    handleInlineOcr: Function,
    handleRefLeaseEmit: Function,
    handleDefdocEmit: Function,
    handleMoneydocEmit: Function,
    handleMarkdownEditorEmit: Function,
    handleCityEmit: Function,
    handleUploaderEmit: Function,
    handleInputNumberEmit: Function,
    handleOcr: Function,
    formatDatePickerValue: Function,
    selectObject: Object
  },
  methods: {
    getSelectLabel (item, value) {
      let label = ''
      if (Object.keys(this.selectObject).length > 0) {
        if (![NaN, null, '', undefined].includes(value)) {
          if (Array.isArray(value) && value.length > 0) {
            const labelList = []
            value.forEach(valueItem => {
              labelList.push(this.selectObject[item.prop][valueItem])
            })
            label = labelList.join(',')
          } else {
            if (typeof value === 'string' && value.includes(',')) {
              const valueList = value.split(',')
              const labelList = []
              valueList.forEach(valueItem => {
                labelList.push(this.selectObject[item.prop][valueItem])
              })
              label = labelList.join(',')
            } else {
              label = this.selectObject[item.prop][value]
            }
          }
        }
      }
      return label
    }
  }
}
</script>

<style>

</style>