<!--
 * @Author: tengmingxue 1473375109@qq.com
 * @Date: 2023-08-31 15:17:20
 * @LastEditors: tengmingxue 1473375109@qq.com
 * @LastEditTime: 2023-09-22 17:18:58
 * @FilePath: \xld-gis-admin\src\views\dataAdmin\dataAdmin\flowStep\handleLog.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="handle-log-table">
    <BasicTable @register="registerTable" :clickToRowSelect="false">
      <template #pdate="{ record }">
        <Tag :color="'red'">
          {{ record.handlerTime ? moment(record.handlerTime).format('YYYY-MM-DD HH:mm:ss') : '' }}
        </Tag>
      </template>
      <template #ISPASS="{ record }">
        <Tag :style="`color:${record.ISPASS === 0 ? 'red' : '#05B069'};`">
          {{ record.ISPASS == 0 ? '不通过' : record.ISPASS == 1 ? '通过' : record.ISPASS }}
        </Tag>
      </template>
    </BasicTable>
  </div>
</template>
<script lang="ts">
import { defineComponent, onBeforeMount, onMounted, ref, watch } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { columns } from './table.data';
import { RoleEnum } from '/@/enums/roleEnum';
import { Authority } from '/@/components/Authority';
import { useMessage } from '/@/hooks/web/useMessage';
import { Switch, Popconfirm } from 'ant-design-vue';

import Moment from 'moment';
const props = {
  flowStatus: { type: String, default: '1' },  //流程状态 1，新增  2 审核
  pageData: { type: Object, default: ref(null) },
}
export default defineComponent({
  name: 'RoleManagement',
  components: { BasicTable, TableAction, Authority, Switch, Popconfirm },
  props,
  setup(props) {
    const flowStatus = ref(props.flowStatus)
    const checkInfo = [
      { flowStep: '开始', handleDept: '发电组', handler: '张山', handlerTime: '2013-09-02 11:23:56', status: 1, suggestion: '不按章程来', illustrate: '处理' },
      { flowStep: '审核1', handleDept: '发电组', handler: '张山', handlerTime: '2013-09-02 11:23:56', status: 2, suggestion: '不按章程来', illustrate: '处理' }
    ]
    const checkList = ref([]);
    const [registerTable, { reload }] = useTable({
      api: () => {
        return new Promise<void>((resolve, reject) => {
          console.log('组件审核步骤列表:', props.pageData)
          resolve(props.pageData || [])
        })
      },
      dataSource: checkList,
      columns,
      useSearchForm: false,
      showTableSetting: false,
      bordered: true,
      showIndexColumn: true,
      pagination: false,
      //   pagination: {
      //     hideOnSinglePage: false,
      //   },
    });
    const moment = Moment;
    const { createMessage } = useMessage();
    watch(() => props.flowStatus, (val) => {
      flowStatus.value = val
      checkList.value = flowStatus.value === '1' ? [] : checkInfo as any;
    })
    watch(() => props.pageData, () => reload())
    onMounted(async () => {
      checkList.value = flowStatus.value === '1' ? [] : checkInfo as any;
    });
    onBeforeMount(async () => { });

    return {
      moment,
      flowStatus,
      checkInfo,
      checkList,
      createMessage,
      registerTable,
      RoleEnum,
    };
  },
});
</script>
<style lang="less" scoped>
.handle-log-table {
  height: 100%;
}
</style>

  