<template>
  <div>
    <h-row>
      <h-col :span="12">
        <div>
          浏览权限设置：
          <h-b-radio-group
            v-model:value="operatorVal"
            :options="optionsViewAuth"
            @change="changeViewAuth"
          ></h-b-radio-group>
        </div>
      </h-col>
    </h-row>
    <h-divider />
    <HBCustomSelect
      ref="componentRef"
      width="100%"
      v-model:value="selectValue"
      valueType="string"
      :labelInValue="true"
      :componentType="props.modalParam.params.attr?.componentType"
      :dataQueryType="props.modalParam.params.attr?.dataQueryType"
      hasPath="1"
    />
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref, toRef } from 'vue';
import { useI18n } from '@crami/locale';
export default defineComponent({
  name: 'PermissionPllicyContent',
  components: {
    // MemberTransfer,
  },
  props: {
    modalParam: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  setup(props, context) {
    console.log(props, 'ppc');
    const { t } = useI18n();
    const componentRef = ref();

    const operatorVal = ref('1');
    const selectValue = ref([]);
    let modalParam: any = toRef(props, 'modalParam');
    selectValue.value = [].concat(modalParam.value?.data?.subject);
    operatorVal.value = modalParam.value?.data?.operator;
    const optionsViewAuth = [
      { label: '授予', value: '1' },
      { label: '拒绝', value: '2' },
    ];
    const changeViewAuth = (e: any) => {
      console.log('ViewAuthVal:' + e);
      context.emit('changeAuthVal', e);
    };
    onMounted(() => {
      changeViewAuth(operatorVal.value);
    });

    const getTableData = () => {
      return selectValue.value;
    };

    return {
      t,
      componentRef,
      props,

      getTableData,
      selectValue,
      operatorVal,
      optionsViewAuth,
      changeViewAuth,
    };
  },
});
</script>

<style lang="less"></style>
