<template>
  <div>
    <FormItem :label="t('权限范围')">
      <a-select
        v-model:value="processInfo.authConfig.authType"
        style="width: 100%"
        :options="authTypeOptions"
      />
    </FormItem>

    <MemberTable
      v-show="showList"
      v-model:memberList="processInfo.authConfig.authMemberConfigs"
      :isCommonType="true"
    />
  </div>
</template>

<script setup lang="ts" name="ProcessPermission">
  import { storeToRefs } from 'pinia';
  import { computed } from 'vue';
  import FormItem from '/@bpmn/layout/FormItem.vue';
  import { useBpmnStore } from '/@bpmn/store/bpmn';
  import MemberTable from '/@bpmn/components/member/MemberTable.vue';
  import { AuthType } from '/@/enums/workflowEnum';
  import { useI18n } from '/@/hooks/web/useI18n';
  const { t } = useI18n();
  const store = useBpmnStore();
  const { processInfo } = storeToRefs(store);
  const showList = computed(() => {
    return processInfo.value.authConfig.authType === AuthType.APPOINT;
  });
  const authTypeOptions = [
    {
      value: AuthType.ALL,
      label: t('所有人员'),
    },
    {
      value: AuthType.APPOINT,
      label: t('指定人员'),
    },
  ];
</script>

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