<template>
  <!-- 修改套保品种 -->
  <a-modal class="commonModal modify-custom"
           title="修改套保品种"
           v-if="visible"
           v-model:visible="visible"
           centered
           :maskClosable="maskClosableFlag"
           @cancel="cancel"
           width="890px">
    <template #footer>
      <a-button key="submit"
                type="primary"
                :loading="loading"
                @click="submit">完成</a-button>
    </template>
    <a-form class="inlineForm"
            ref="formRef"
            :model="formState"
            :rules="rules">
      <fieldset class="formFieldSet">
        <legend>基本信息</legend>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="套保品种名称">
              <span>{{selctedMG.mg.middlegoodsname}}</span>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="单位">
              <span>{{getGoodsUnitEnumItemName(selctedMG.mg.goodsunitid)}}</span>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="当前套保比例">
              <span>{{(selctedMG.mg.needhedgeratio * 100).toFixed(2)}}%</span>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="修改后套保比例">
              <a-input class="dialogInput"
                       v-model:value="domain.wrstandardname"
                       placeholder="请输入品类"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </fieldset>
      <fieldset class="formFieldSet">
        <legend>其他信息</legend>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item label="备注">
              <span>{{selctedMG.mg.remark}}</span>
            </a-form-item>
          </a-col>
        </a-row>
      </fieldset>
    </a-form>
  </a-modal>
</template>

<script lang="ts">
import { defineComponent, PropType, ref } from 'vue';
import { closeModal } from '@/common/setup/modal/index';
import { initData } from '@/common/methods/index';
import { initMG } from '../../list/hedging-variety/setup';
import { Ermcp3MiddleGoodsDetail2 } from '@/services/go/ermcp/goodsInfo/interface';
import { getGoodsUnitEnumItemName } from '@/common/constants/enumsName';

export default defineComponent({
    name: 'modify-custom',
    components: {},
    selctedMG: {
        default: initMG,
        type: Object as PropType<Ermcp3MiddleGoodsDetail2>,
    },
    setup() {
        const { visible, cancel } = closeModal('goods_info_hedge_normal_modify');

        const loading = ref<boolean>(false);
        function submit() {
            cancel();
        }
        initData(() => {});
        return {
            visible,
            cancel,
            submit,
            loading,
            maskClosableFlag: false,
            getGoodsUnitEnumItemName,
        };
    },
});
</script>

<style lang="less">
.modify-custom {
    .upload {
        display: inline-flex;
        .ant-btn.uploadBtn {
            width: 60px;
            height: 30px;
            background: @m-blue0;
            border: 0;
            padding: 0;
            text-align: center;
            font-size: 14px;
            color: @m-white0;
            .rounded-corners(3px);
            &:hover {
                background: rgba(@m-blue0, 0);
                color: rgba(@m-white0, 0.8);
            }
        }
        .look {
            color: @m-blue0;
            font-size: 14px;
            margin-left: 10px;
            cursor: pointer;
        }
    }
}
</style
>;
