mobilizeRecord.vue
3.39 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
<view>
<view class="appList">
<view class="appItem" v-for="(item,index) in list" :key="index" @click="goDetail(item)">
<view class="status">
<text :class="statusClass(item)">{{ statusText(item) }}</text>
</view>
<view class="name mt0">
{{ item.name || '调动记录' }}
</view>
<view class="flexbox" v-if="deptType == 1 || deptType == 2 || deptType == 3">
<view class="w50">
申请调入单位
<view><text>{{ item.targetDeptName || '-' }}</text></view>
</view>
<view class="w50">
会员合计
<view>{{ item.personCount || 0 }}</view>
</view>
</view>
<view v-else class="pp">
会员合计:
<text class="text-primary">{{ item.personCount || 0 }}</text>
</view>
</view>
</view>
<view class="nodata" v-if="list.length==0 && !loading">
<image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image>
<text>暂无数据</text>
</view>
</view>
</template>
<script setup>
import * as api from '@/common/api.js'
import config from '@/config.js'
import { ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
const app = getApp()
const queryParams = ref({})
const list = ref([])
const total = ref(0)
const deptType = ref('')
const loading = ref(false)
const hasInited = ref(false)
onLoad(() => {
if (app.globalData.isLogin) {
init()
} else {
app.firstLoadCallback = () => {
init()
}
}
})
onShow(() => {
if (hasInited.value) {
getList()
}
})
function init() {
deptType.value = app.globalData.deptType
queryParams.value = {}
if (deptType.value == 2 || deptType.value == 3) {
queryParams.value.dgId = -1
}
if (deptType.value == 1) {
queryParams.value.dgId = -2
}
if (deptType.value == 6) {
queryParams.value.dgId = 1
}
hasInited.value = true
getList()
}
function getList() {
loading.value = true
uni.showLoading({
title: '加载中',
mask: true
})
api.getMobilizelist(queryParams.value).then(res => {
list.value = res.rows || []
total.value = res.total || 0
}).finally(() => {
loading.value = false
uni.hideLoading()
})
}
function statusText(item) {
if (deptType.value == 1) {
const map = {
0: '审核中',
1: '审核通过',
2: '审核拒绝',
3: '撤销申请'
}
return map[item.ztxRes] || '-'
}
if (deptType.value == 2 || deptType.value == 3) {
const map = {
0: '审核中',
1: '审核通过',
2: '审核拒绝',
3: '撤销申请'
}
return map[item.shenRes] || '-'
}
const map = {
0: '待提交',
1: '审核中',
2: '审核拒绝',
3: '审核通过',
4: '已撤回'
}
return map[item.status] || '-'
}
function statusClass(item) {
const value = deptType.value == 1 ? item.ztxRes : (deptType.value == 2 || deptType.value == 3 ? item.shenRes : item.status)
if (value == 1 || value == 3) return 'text-success'
if (value == 2 || value == 4) return 'text-danger'
return 'text-primary'
}
function goDetail(item) {
const auditLog = encodeURIComponent(JSON.stringify(item.auditLog))
const form = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url: `/personalVip/mobilizeDetail?rangeId=${item.id}&auditLog=${auditLog}&form=${form}`
})
}
</script>
<style scoped lang="scss">
.mt0 {
margin-top: 0 !important;
}
.appList .appItem .name {
width: 80%;
word-break: break-all;
}
</style>