Blame view

src/views/project/order/HistoryDetail.vue 5.34 KB
sanmu authored
1
2
<template>
  <BasicDrawer
sanmu authored
3
    @register="register"
sanmu authored
4
5
6
7
8
9
    v-bind="$attrs"
    title="操作记录"
    width="60%"
    :isDetail="true"
    :showDetailBack="false"
    okText="保存"
sanmu authored
10
    :destroyOnClose="true"
sanmu authored
11
  >
sanmu authored
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
    <Tabs v-model:activeKey="activeKey" className="my-0">
      <TabPanel :key="1" tab="操作记录" className="w-full">
        <a-list :pagination="pagination1" className="w-full">
          <template v-for="item in list1" :key="item.id">
            <a-list-item class="list">
              <a-list-item-meta>
                <template #avatar> </template>
                <template #title>
                  <span>{{ item.userName }}</span>
                </template>
                <template #description>
                  <div class="description">
                    {{ item.optType }}
                  </div>
                  <div class="info">
                    <div><span>操作时间:</span>{{ formatToDateTime(item.createTime) }}</div>
                  </div>
                </template>
              </a-list-item-meta>
            </a-list-item>
          </template>
        </a-list>
      </TabPanel>
      <TabPanel :key="2" tab="审批记录" className="w-full">
        <a-list :pagination="pagination2" className="w-full">
          <template v-for="item in list2" :key="item.id">
            <a-list-item class="list">
              <a-list-item-meta>
                <template #avatar> </template>
                <template #title>
                  <span>{{ item.applyUserName }}</span>
                </template>
                <template #description>
                  <div class="description">
                    {{ item.applyRemark }}
                  </div>
                  <div class="info">
                    <div><span>操作时间:</span>{{ formatToDateTime(item.createTime) }}</div>
                  </div>
                </template>
              </a-list-item-meta>
            </a-list-item>
          </template>
        </a-list>
      </TabPanel>
sanmu authored
57
58
    </Tabs>
sanmu authored
59
    <!-- <template #titleToolbar> <a-button type="primary"> 申请编辑权限 </a-button></template> -->
sanmu authored
60
61
62
63
64
65
    <template #appendFooter>
      <!-- <a-button type="primary" @click="onGoCheckDetail"> 申请权限</a-button> -->
    </template>
  </BasicDrawer>
</template>
<script lang="ts">
sanmu authored
66
  import { defineComponent, ref, computed } from 'vue';
sanmu authored
67
  import { Tabs, Progress, Row, Col, List } from 'ant-design-vue';
sanmu authored
68
  import { FormSchema, useForm } from '/@/components/Form/index';
sanmu authored
69
70

  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
sanmu authored
71
72
73
74
  import { getOrderAuditLog, getOrderOptLog } from '/@/api/project/order';
  import { formatToDateTime } from '/@/utils/dateUtil';

  const TabPanel = Tabs.TabPane;
sanmu authored
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

  const schemas: FormSchema[] = [
    {
      field: '订单号',
      component: 'Input',
      label: '字段1',
      componentProps: {
        readonly: true,
        disabled: true,
      },
      colProps: {
        span: 12,
      },
      defaultValue: '111',
    },
    {
      field: 'field2',
      component: 'Input',
      label: '字段2',
      colProps: {
        span: 12,
      },
    },
  ];
  const achieveList = [
    {
      key: '1',
sanmu authored
102
      name: '操作记录',
sanmu authored
103
104
105
106
107
108
109
110
111
112
    },
    {
      key: '2',
      name: '审批记录',
    },
  ];
  export default defineComponent({
    components: {
      BasicDrawer,
      Tabs,
sanmu authored
113
      TabPanel,
sanmu authored
114
115
116
117
118
119
120
121
122
123
      [List.name]: List,
      [List.Item.name]: List.Item,
      AListItemMeta: List.Item.Meta,
    },
    props: {
      onGoCheckDetail: {
        type: Function,
      },
    },
    setup() {
sanmu authored
124
125
126
127
128
129
130
131
132
133
134
      const list1 = ref([]);
      const total1 = ref(0);
      const page1 = ref(1);

      const list2 = ref([]);
      const total2 = ref(0);
      const page2 = ref(1);
      const orderId = ref('');
      const activeKey = ref(1);

      const getOrderOptLogFunc = async (data, index, page) => {
sanmu authored
135
        console.log('%c [ data ]-135', 'font-size:13px; background:pink; color:#bf2c9f;', data);
sanmu authored
136
        if (index === 1) {
sanmu authored
137
          const res = await getOrderOptLog({ orderId: data, page: page, pageSize: 20 });
sanmu authored
138
139
140
141
          list1.value = res.records;
          total1.value = res.total;
          page1.value = page;
        } else {
sanmu authored
142
          const res = await getOrderAuditLog({ orderId: data, page: page, pageSize: 20 });
sanmu authored
143
144
145
146
147
          list2.value = res.records;
          total2.value = res.total;
          page2.value = page;
        }
      };
sanmu authored
148
      const [register] = useDrawerInner((data) => {
sanmu authored
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
        orderId.value = data.id;
        getOrderOptLogFunc(orderId.value, 1, 1);
        getOrderOptLogFunc(orderId.value, 2, 1);
      });

      const pagination1 = computed(() => {
        return {
          show: true,
          pageSize: 20,
          page: page1.value,
          total: total1.value,
          onChange(cur) {
            getOrderOptLogFunc(orderId.value, 1, cur);
          },
        };
      });

      const pagination2 = computed(() => {
        return {
          show: true,
          pageSize: 20,
          page: page1.value,
          total: total1.value,
          onChange(cur) {
            getOrderOptLogFunc(orderId.value, 2, cur);
          },
        };
sanmu authored
176
      });
sanmu authored
177
sanmu authored
178
179
180
181
      return {
        register,
        schemas,
        achieveList,
sanmu authored
182
183
        list1,
        list2,
sanmu authored
184
        prefixCls: 'account-center',
sanmu authored
185
186
187
188
        pagination1,
        pagination2,
        activeKey,
        formatToDateTime,
sanmu authored
189
190
191
192
      };
    },
  });
</script>