<template>
    <div class="inputWithSelectCom" style="display:flex;margin-left: 10px;"> 
      <!-- height: 30px; -->
        <!-- <Input
            v-model="value"
            type="text"
            class='typeInputText'
            :placeholder="placeholderText"
            >
            <Select
                slot="prepend"
                v-model="condition"
                style="width:60px;background: #fff; color: #333333;"
                placeholder=''
                @on-change="change"
            >
                <Option
                    v-for="condition in conditionList"
                    :key="condition.value"
                    :value="condition.value"
                >
                    {{ condition.label }}
                </Option>
            </Select>
        </Input> -->
        <Select
          v-model="ACTUALAMOUNT_TYPE"
          style="width:60px;background: #fff; color: #333333;"
          placeholder=''
          @on-change="change"
          :disabled='isDisabled'
        >
          <Option
            v-for="condition in conditionList"
            :key="condition.value"
            :value="condition.value"
          >
            {{ condition.label }}
          </Option>
        </Select>
        <Input
        v-model="ACTUALAMOUNT_VALUE"
        type="text"
        :disabled='isDisabled'
        class='typeInputTextOne'
        :placeholder="placeholderText"
        :regx="options.colname=='ACTUALAMOUNT_STR'?'':regx1"
        @on-change="changeOne"
        ></Input>
    </div>
  
  </template>
  
  <script type="text/ecmascript-6">
  export default {
    name: 'InputWithSelect',
  
    props: {
      options: {
        type: Object,
        default: () => ({})
      }
    },
  
    data() {
      return {
        isDisabled: false,
        regx1:/^\d{0,15}?$/,
        ACTUALAMOUNT_VALUE: '',
        ACTUALAMOUNT_TYPE: 1,
        placeholderText: '请输入成交金额',
        conditionList: [
            {
                label: '大于',
                value: 1
            },
            {
                label: '等于',
                value: 2
            },
            {
                label: '小于',
                value: 3
            },
        ]
      };
    },
  
    methods: {
      change(e) {
        let type = this.ACTUALAMOUNT_TYPE==3?'小于':this.ACTUALAMOUNT_TYPE==2?'等于':'大于'
        let value = this.ACTUALAMOUNT_VALUE?type+this.ACTUALAMOUNT_VALUE:''
        this.$emit('change', value);
      },
      changeOne(e) {
        let type = this.ACTUALAMOUNT_TYPE==3?'小于':this.ACTUALAMOUNT_TYPE==2?'等于':'大于'
        let value = this.ACTUALAMOUNT_VALUE?type+this.ACTUALAMOUNT_VALUE:''
        this.$emit('change', value);
      }
    },
  
    mounted() {
      const moduleComponentName = this.$route.meta.moduleName;
      setTimeout(()=>{
        this.isDisabled = window.parent.R3.store.state[moduleComponentName].updateData.T_IES_PACKAGING_MATERIAL_RULE.default.T_IES_PACKAGING_MATERIAL_RULE.DEFAULT_PACKAGING_MATERIAL == 1?true:false;
      },500)
      
      console.log(this.options)
      this.placeholderText = '请输入'+this.options.coldesc
      // if(this.options.colname == '"PRODUCT_NUM_STR"'){
      //   this.placeholderText='请输入商品数量'
      // }
      //console.log(this.isDisabled)// this.isDisabled = this.options.webconf.setAttributes.props.disabled
      if(this.options.valuedata) {
        let type = this.options.valuedata.slice(0,2);
        let value = this.options.valuedata.slice(2);
        this.ACTUALAMOUNT_TYPE = type=='小于'?3:type=='等于'?2:1;
        this.ACTUALAMOUNT_VALUE = value
      }
    }
  };
  </script>
  
  <style lang="scss" >
  .inputWithSelectCom .ark-input-group-prepend .ark-select-selection,.inputWithSelectCom .ark-input-group-append .ark-select-selection {
    border: 1px solid #d8d8d8 !important;
    margin-top: -1px;
  }
  </style>
  