xuruiqian
2025-02-25 e85ab165147c37b571ea67ce6f6ae9ae55a96070
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
122
<template>
  <div v-if="!loading">
    <el-table v-loading="loading" :data="entityList" stripe border size="default" highlight-current-row
              element-loading-text="Loading..." element-loading-spinner="el-icon-loading"
              element-loading-background="rgba(0, 0, 0, 0.8)"
              :header-row-style="{ height: '45px', color: 'var(--el-color-primary)', background: 'var(--el-color-info-light)', }"
              :header-cell-style="{ height: '45px', margin: '0px', padding: '0px', background: 'var(--el-color-info-light)' }"
              @row-dblclick="showApprovalCenter">
      <el-table-column type="index" fixed :label="$t('label.Index')" width="80"/>
      <el-table-column prop="title" sortable align="left" :label="$t('label.Title')" width="300"/>
      <el-table-column prop="startdatetime" sortable align="left" :label="$t('label.ScheduledStartTime')"
                       width="160">
        <template #default="scope">
          <p class="text-overflow">
            <span>{{ `${formatterDatetime(scope.row.startdatetime)}` }}</span>
          </p>
        </template>
      </el-table-column>
      <el-table-column prop="enddatetime" sortable align="left" :label="$t('label.ScheduledFinishedTime')"
                       width="160">
        <template #default="scope">
          <p class="text-overflow">
            <span>{{ `${formatterDatetime(scope.row.enddatetime)}` }}</span>
          </p>
        </template>
      </el-table-column>
      <el-table-column prop="createtime" min-width="160" width="*" align="left"
                       :label="$t('label.CreateTime')">
        <template #default="scope">
          <p class="text-overflow">
            <span>{{ `${formatterDatetime(scope.row.createtime)}` }}</span>
          </p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" :label="$t('label.Operation')" width="130">
        <template #default="scope">
          <el-button @click="showApprovalCenter(scope.row)" :icon="icon.More"
                     :title="$t('button.Detail')"
                     size="small" type="primary" plain circle>
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="display: flex;justify-content: space-between">
      <div>
 
      </div>
      <div>
        <el-link type="primary" @click="showApprovalCenter">
          {{ `${$t('button.More')}` }}
          <el-icon>
            <Right/>
          </el-icon>
        </el-link>
      </div>
    </div>
  </div>
  <el-skeleton v-else :rows="5"/>
</template>
 
<script>
 
import {getCurrentInstance, onBeforeUnmount, onMounted, reactive, toRefs} from "vue";
import {useBasicInfoStore} from "@/store/basicInfo";
import * as icon from "@element-plus/icons-vue";
import {formatterDate, formatterDatetime, formatterNumber} from "@/utils/common";
import {GetApprovalList} from "@/api/admin/ifc";
 
export default {
  name: 'LatestApproval',
  components: {},
  setup() {
    let {proxy} = getCurrentInstance();
    const store = useBasicInfoStore();
    const state = reactive({
      loading: false,
      entityList: [],
    });
 
    onMounted(() => {
      Init();
      LoadData();
    });
    onBeforeUnmount(() => {
 
    });
 
    const Init = () => {
 
    };
    const LoadData = () => {
      state.loading = true;
      let userid = store.user.id;
 
      GetApprovalList(userid).then(resp => {
        if (resp.data) {
          state.entityList = resp.data.data;
        }
        state.loading = false;
      }).catch(err => {
        console.error(err);
      });
    };
    const showApprovalCenter = () => {
      store.launchIframe(`${WGURL.ifcDomain}/client/center/approval`, `${proxy.$t('label.ApprovalCenter')}`);
    }
 
    return {
      ...toRefs(state),
      icon,
      formatterDate,
      formatterDatetime,
      formatterNumber,
      showApprovalCenter,
    }
  },
}
</script>
 
<style scoped>
 
</style>