mobilizeRecord.vue 3.39 KB
<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>