dialog_approval.vue 3.62 KB
<script lang="ts" setup name="DialogApproval">
import { TableColumnWidth } from '@/utils/enum';
import {
  getCrossDetailList,
  crossPlatformApprove
} from '@/api/modules/workFlowService';

const { proxy } = getCurrentInstance() as any;

const emits = defineEmits([
  "dialogCancel"
]);

const props = defineProps({
  visible: {
    type: Boolean,
    default: false
  },
  currentRowInfo: {
    type: Object,
    default: {
    }
  }
})

const dialogInfo = ref({
  visible: false,
  size: 700,
  direction: "column",
  header: {
    title: "主平台审批节点",
  },
  footer: {
    visible: false
  }
});

watch(() => props.visible, () => {
  dialogInfo.value.visible = props.visible;
  if (props.visible) {
    isReSubmit.value = false;
    tableInfo.value.data = [];
    tableInfo.value.actionInfo.show = props.currentRowInfo?.crossPlatformApproveState == 'E';
    gettableList();
  }
}, {
  immediate: true
})

/** 获取版本信息数据 */
const gettableList = () => {
  tableInfo.value.loading = true;
  getCrossDetailList({
    pageIndex: 1,
    pageSize: -1,
    bizGuid: props.currentRowInfo.guid
  }).then((res: any) => {
    tableInfo.value.loading = false;
    if (res.code == proxy.$passCode) {
      const data = res.data || [];
      tableInfo.value.data = data?.map(d => {
        d.approveState = d.approveState == null ? undefined : d.approveState;
        return d;
      });
      tableInfo.value.actionInfo.show = tableInfo.value.data?.[0] && data?.[0]?.approveState == 'E';
    } else {
      proxy.$ElMessage.error(res.msg);
    }
  })
}

const isReSubmit = ref(false);

const tableInfo = ref({
  id: 'approval-table',
  loading: false,
  minPanelHeight: "60px",
  minHeight: "60px",
  fields: [
    { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center", fixed: "left" },
    {
      label: "节点", field: "processName", width: 90
    },
    { label: "处理对象", field: "operator", width: TableColumnWidth.USERNAME },
    { label: "操作时间", field: "operatingTime", width: TableColumnWidth.DATETIME, },
    {
      label: "审批状态", field: "approveState", width: 120, type: 'tag', align: 'center'
    },
    { label: "审批原因", field: "approveSuggest", width: TableColumnWidth.DESCRIPTION },
  ],
  data: [],
  showPage: false,
  actionInfo: {
    show: props.currentRowInfo?.crossPlatformApproveState == 'E',
    label: "操作",
    type: "btn",
    width: 100,
    btns: [{
      label: '重新发起',
      click: (scope) => {
        tableInfo.value.loading = true;
        crossPlatformApprove({ approveGuid: props.currentRowInfo.approveVO.approveGuid, guid: props.currentRowInfo.guid }).then((res: any) => {
          tableInfo.value.loading = false;
          if (res.code == proxy.$passCode) {
            proxy.$ElMessage({
              type: "success",
              message: '重新发起成功',
            });
            gettableList();
            isReSubmit.value = true;
          } else {
            proxy.$ElMessage({
              type: "error",
              message: res.msg,
            });
          }
        })
      }
    }]
  }
});

const handleDialogCancel = () => {
  dialogInfo.value.visible = false;
  emits("dialogCancel", isReSubmit.value);
}

</script>

<template>
  <el-dialog v-model="dialogInfo.visible" :title="dialogInfo.header.title" width="700" :modal="true"
    :close-on-click-modal="true" destroy-on-close align-center @close="handleDialogCancel">
    <Table ref="tableRef" :tableInfo="tableInfo" class="approval-table" />
  </el-dialog>
</template>

<style lang="scss" scoped>
.approval-table {
  height: 180px !important;
}

:deep(.cusror-inherit) {
  cursor: inherit;
}
</style>