wupengfei
5 天以前 fea063f5c7fdf79d56ada2dd2b8045a44ca2db44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<template>
  <ProDialog :title="title" v-model="visible" destroy-on-close draggable>
    <ProDialogTableWrapper :height="400">
      <ProTableV2 v-bind="proTableProps" :columns="columns" :operationBtns="operationBtns">
      </ProTableV2>
    </ProDialogTableWrapper>
    <template #footer>
      <span class="dialog-footer">
        <el-button v-if="form.type === 'detail'" @click="emit('onCancel')" type="primary"
          >确定</el-button
        >
        <template v-if="form.type === 'check'">
          <el-button @click="emit('check', false)">验收未通过</el-button>
          <el-button type="primary" @click="emit('check', true)">验收通过</el-button>
        </template>
      </span>
    </template>
  </ProDialog>
</template>
 
<script setup lang="ts">
import {
  ProDialog,
  ProTableV2,
  ProDialogTableWrapper,
  defineColumns,
  defineOperationBtns,
  useTable,
} from '@bole-core/components';
 
defineOptions({
  name: 'EnterpriseConsumptionDetailDialog',
});
 
type Form = {
  id: string;
  type: string;
};
 
const visible = defineModel({ type: Boolean });
const form = defineModel<Form>('form');
const title = computed(() => (form.value.type === 'check' ? '验收' : '详情'));
const emit = defineEmits<{
  (e: 'onCancel'): void;
  (e: 'check', value: boolean): void;
}>();
 
const columns = defineColumns([
  {
    id: '1',
    enCode: 'creationTime',
    name: '提交时间',
  },
  {
    id: '2',
    enCode: 'type',
    name: '验收照片',
  },
]);
 
const operationBtns = defineOperationBtns([
  {
    data: {
      enCode: 'downloadBtn',
      name: '下载',
    },
    emits: {
      onClick: (role) => handleDownload(role),
    },
  },
]);
 
watch(
  () => visible.value,
  (val) => {
    if (val) {
      getList();
    }
  },
  {
    immediate: true,
  }
);
 
const {
  getDataSource: getList,
  proTableProps,
  paginationState,
  extraParamState,
  reset,
} = useTable(
  async ({ pageIndex, pageSize }, extraParamState) => {
    try {
      let params: API.GetFlexEnterpriseInput = {
        pageModel: {
          rows: pageSize,
          page: pageIndex,
          orderInput: extraParamState.orderInput,
        },
      };
      let res = await flexEnterpriseServices.getFlexEnterpriseList(params);
      return res;
    } catch (error) {
      console.log('error: ', error);
    }
  },
  {
    defaultExtraParams: {
      orderInput: [{ property: 'id', order: EnumPagedListOrder.Desc }],
    },
    queryKey: ['flexEnterpriseServices/getFlexEnterpriseList'],
    columnsRenderProps: {},
  }
);
 
function handleDownload(row) {}
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
</style>