import { TaskStatus } from '@/utils/enums';
import { checkPermi } from '@/utils/permission';
import { mapGetters } from 'vuex';
export const $task = {
  computed: {
    ...mapGetters(['userId']),
    // 是否可以开始
    canStart() {
      return (row) => {
        return checkPermi(['bst:task:start']) 
          && TaskStatus.canStart().includes(row.status) 
          && row.ownerId === this.userId;
      }
    },
    // 是否可以提交
    canSubmit() {
      return (row) => {
        return checkPermi(['bst:task:submit']) 
          && TaskStatus.canSubmit().includes(row.status) 
          && row.ownerId === this.userId;
      }
    },
    // 是否可以取消
    canCancel() {
      return (row) => {
        return checkPermi(['bst:task:cancel']) 
          && TaskStatus.canCancel().includes(row.status);
      }
    }
  }
}