|
@@ -1,13 +1,14 @@
|
|
|
<template>
|
|
|
<div class="approve-container flex flex-col">
|
|
|
- <van-tabs v-model="activeName">
|
|
|
+ <van-tabs v-model="tabVal"
|
|
|
+ :before-change="handleTabBeforeChangeEvnet"
|
|
|
+ >
|
|
|
<van-tab
|
|
|
v-for="(tab, idx) in tabs"
|
|
|
:key="idx"
|
|
|
:title="tab.title"
|
|
|
:name="tab.name"
|
|
|
color="#000"
|
|
|
- @before-change="handleTabBeforeChangeEvnet"
|
|
|
/>
|
|
|
</van-tabs>
|
|
|
<div class="filter-container p-h-12 flex flex-row flex-row-aic">
|
|
@@ -31,20 +32,35 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="approve-main">
|
|
|
- <!-- TODO:需要一个滚动框架 是否需要采用 `mescroll.js` -->
|
|
|
- <approve-item
|
|
|
- approve-type="xx"
|
|
|
- title="刘辉提出的申请"
|
|
|
- time="15:00"
|
|
|
- :rows="example"
|
|
|
- wait-personal="刘德华"
|
|
|
- :wait-status="1"
|
|
|
- :approved-status="2"
|
|
|
+ <van-list
|
|
|
+ v-model="listLoading"
|
|
|
+ :finished="finished"
|
|
|
+ :finished-text="finishedText"
|
|
|
+ @load="onLoadData"
|
|
|
+ >
|
|
|
+ <approve-item
|
|
|
+ v-for="(item, idx) in tableData"
|
|
|
+ :key="idx"
|
|
|
+ approve-type="xx"
|
|
|
+ :title="item.__title__"
|
|
|
+ :time="item.apply_date"
|
|
|
+ :rows="item.__rows_item__"
|
|
|
+ :person="tabVal != 3 ? item.approve_one.user.name : ''"
|
|
|
+ flag="approve"
|
|
|
+ :flag-state="Number(tabVal)"
|
|
|
+ @click="handleGoInfo(item)"
|
|
|
+ />
|
|
|
+ </van-list>
|
|
|
+
|
|
|
+ <my-empty
|
|
|
+ v-show="showEmpty"
|
|
|
+ tip="暂无数据"
|
|
|
/>
|
|
|
|
|
|
- <div class="btnbox" @click="goexamine">jumptoexamine-pass</div>
|
|
|
+ <!-- useless. -->
|
|
|
+ <!-- <div class="btnbox" @click="goexamine">jumptoexamine-pass</div>
|
|
|
<div class="btnbox" @click="goexamine2">jumptoexamine-refuse</div>
|
|
|
- <div class="btnbox" @click="goDetail">goDetail</div>
|
|
|
+ <div class="btnbox" @click="goDetail">goDetail</div> -->
|
|
|
|
|
|
<!-- <my-empty tip="暂无待处理的" /> -->
|
|
|
</div>
|
|
@@ -57,6 +73,7 @@
|
|
|
:style="{ height: '90%' }"
|
|
|
closeable
|
|
|
close-icon-position="top-left"
|
|
|
+ @click-close-icon="handleClosePopup"
|
|
|
>
|
|
|
<div>
|
|
|
<div class="popup__title">全部筛选</div>
|
|
@@ -64,12 +81,16 @@
|
|
|
<div class="popup__typebox__header">
|
|
|
<span>全部类型</span>
|
|
|
</div>
|
|
|
- <div class="popup__typebox__list flex">
|
|
|
+ <div class="popup__typebox__list">
|
|
|
<span
|
|
|
v-for="(type, idx) in types"
|
|
|
:key="idx"
|
|
|
class="item"
|
|
|
- @click="handleTouchThatType(event, type)"
|
|
|
+ :class="[
|
|
|
+ 'item',
|
|
|
+ type.id === typeVal ? 'item--selected' : ''
|
|
|
+ ]"
|
|
|
+ @click="handleTouchThatType($event, type)"
|
|
|
>
|
|
|
{{ type.name }}
|
|
|
</span>
|
|
@@ -107,12 +128,32 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import store from '@/store'
|
|
|
import ApproveItem from './approve/components/ApproveItem.vue'
|
|
|
|
|
|
+import { getApproveList } from '@/api/approve'
|
|
|
+import { formatApproveItemRow } from '@/utils/approve-item'
|
|
|
+import { mapState } from 'vuex'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
ApproveItem
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapState('enum', {
|
|
|
+ types: state => state.moduleList
|
|
|
+ }),
|
|
|
+ rendeTitleCom () {
|
|
|
+ let t = this.formType
|
|
|
+ let welcomeTxt = `${store.getters.name}提交的`
|
|
|
+ switch (t) {
|
|
|
+ case 5:
|
|
|
+ welcomeTxt += '出差申请'
|
|
|
+ break
|
|
|
+ }
|
|
|
+ return welcomeTxt
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
popupVisibility: false,
|
|
@@ -130,92 +171,129 @@ export default {
|
|
|
val: '急'
|
|
|
}
|
|
|
],
|
|
|
- activeName: '',
|
|
|
+
|
|
|
+ tabVal: '1',
|
|
|
tabs: [
|
|
|
{
|
|
|
title: '待处理',
|
|
|
- name: 'wait'
|
|
|
+ name: '1'
|
|
|
},
|
|
|
{
|
|
|
title: '已处理',
|
|
|
- name: 'over'
|
|
|
+ name: '2'
|
|
|
},
|
|
|
{
|
|
|
title: '我收到的',
|
|
|
- name: 'recive'
|
|
|
+ name: '3'
|
|
|
},
|
|
|
],
|
|
|
+
|
|
|
searchVal: '',
|
|
|
- types: [
|
|
|
- { name: '领用申请', id: '' },
|
|
|
- { name: '申请批呈', id: '' },
|
|
|
- { name: '学校文件', id: '' },
|
|
|
- { name: '批阅申请', id: '' },
|
|
|
- { name: '合同批呈', id: '' },
|
|
|
- { name: '维修申请', id: '' },
|
|
|
- { name: '用车申请', id: '' },
|
|
|
- { name: '请假申请', id: '' },
|
|
|
- { name: '出差申请', id: '' },
|
|
|
- { name: '领用申请', id: '' },
|
|
|
- { name: '入库申请', id: '' },
|
|
|
- { name: '申购申请', id: '' },
|
|
|
- ],
|
|
|
+
|
|
|
typeVal: '',
|
|
|
timeStart: '',
|
|
|
- timeEnd: ''
|
|
|
+ timeEnd: '',
|
|
|
+
|
|
|
+ pagination: {
|
|
|
+ page: 1,
|
|
|
+ page_num: 10,
|
|
|
+ },
|
|
|
+ showEmpty: false,
|
|
|
+ listLoading: false,
|
|
|
+ finished: false,
|
|
|
+ finishedText: '暂无更多数据',
|
|
|
+ tableData: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // Tab 切换前验证
|
|
|
- handleTabBeforeChangeEvnet (name) {
|
|
|
- console.log(name);
|
|
|
- // TODO: 切换需要调用接口让数据加载出来。
|
|
|
- return true
|
|
|
+ onLoadData () {
|
|
|
+ this.__record_list__()
|
|
|
},
|
|
|
+ async __record_list__ () {
|
|
|
+ try {
|
|
|
+ const that = this
|
|
|
+ const params = {
|
|
|
+ status: this.tabVal,
|
|
|
+ module: this.typeVal || '', // 默认全部
|
|
|
+ start_time: this.timeStart,
|
|
|
+ end_time: this.timeEnd,
|
|
|
+ }
|
|
|
+ const result = await getApproveList(params)
|
|
|
+ if (result.code === 1) {
|
|
|
+ this.listLoading = false
|
|
|
+ let list = result.data || []
|
|
|
+ list = list.map(item => ({
|
|
|
+ ...item,
|
|
|
+ __title__: `${item.approve_info_user.name}提交的${that.$store.getters['enum/getModuleText'](item.type)}`,
|
|
|
+ __rows_item__: formatApproveItemRow(item, item.module)
|
|
|
+ }))
|
|
|
|
|
|
- // 切换接口中转站
|
|
|
- handleGetListMiddware () {
|
|
|
- let type = this.activeName
|
|
|
-
|
|
|
- switch(type) {
|
|
|
- case 'wait':
|
|
|
- this.__wait__()
|
|
|
- break;
|
|
|
- case 'over':
|
|
|
- this.__over__()
|
|
|
- break;
|
|
|
- case 'recive':
|
|
|
- this.__recive__()
|
|
|
- break;
|
|
|
+ if (list.length < this.pagination.page_num) this.finished = true
|
|
|
+ else this.pagination.page++
|
|
|
+
|
|
|
+ this.tableData = this.tableData.concat(list)
|
|
|
+
|
|
|
+ if (this.finished && !this.tableData.length) {
|
|
|
+ this.finishedText = ''
|
|
|
+ this.showEmpty = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('%c approve record_list error >>>', 'background: blue; color: #fff', error);
|
|
|
}
|
|
|
},
|
|
|
- __wait__ () {},
|
|
|
- __over__ () {},
|
|
|
- __recive__ () {},
|
|
|
+ handleTabBeforeChangeEvnet (val) {
|
|
|
+ this.tabVal = val
|
|
|
+ this.showEmpty = false
|
|
|
+ this.tableData = []
|
|
|
+ this.listLoading = true
|
|
|
+ this.finished = false
|
|
|
+ this.finishedText = '暂无更多数据'
|
|
|
+ this.pagination.page = 1
|
|
|
+ this.timeStart = ''
|
|
|
+ this.timeEnd = ''
|
|
|
+ this.typeVal = ''
|
|
|
+ this.onLoadData()
|
|
|
+ return true
|
|
|
+ },
|
|
|
|
|
|
// NOTE: choosed type
|
|
|
- handleTouchThatType (type) {
|
|
|
- const { name } = type
|
|
|
- this.typeVal = name
|
|
|
+ handleTouchThatType (event, type) {
|
|
|
+ const { id } = type
|
|
|
+ this.typeVal = id
|
|
|
},
|
|
|
|
|
|
// NOTE: 点击跳转搜索页
|
|
|
handleClickSearchBox () {
|
|
|
this.$router.push({
|
|
|
- name: 'Search'
|
|
|
+ name: 'Search',
|
|
|
+ query: {
|
|
|
+ flag: 'approve',
|
|
|
+ flagState: this.tabVal,
|
|
|
+ formType: 0
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- // NOTE: 点击筛选弹出选择内容
|
|
|
- handleSwitchFilterBox () {
|
|
|
+ // NOTE: 提交过滤搜索条件
|
|
|
+ handleSubmitFilter () {
|
|
|
+ this.popupVisibility = false
|
|
|
+ this.onLoadData()
|
|
|
+ },
|
|
|
|
|
|
+ handleClosePopup () {
|
|
|
+ this.typeVal = ''
|
|
|
+ this.timeStart = ''
|
|
|
+ this.timeEnd = ''
|
|
|
},
|
|
|
|
|
|
- // NOTE: 提交过滤搜索条件
|
|
|
- handleSubmitFilter () {
|
|
|
- // NOTE:收集申请类型和申请时间
|
|
|
|
|
|
+ // TODO: 缺少module无法准确进入某一审批详情页面
|
|
|
+ handleGoInfo(item) {
|
|
|
+ console.log('%c handle Go_info >>>', 'background: blue; color: #fff', item);
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
goexamine () {
|
|
|
this.$router.push({
|
|
|
name: 'Examine',
|
|
@@ -318,10 +396,11 @@ export default {
|
|
|
margin-bottom: 12px;
|
|
|
}
|
|
|
&__list {
|
|
|
- flex-wrap: wrap;
|
|
|
- justify-content: space-between;
|
|
|
+ display: grid;
|
|
|
+ grid-template-columns: repeat(3, 33.3%);
|
|
|
+
|
|
|
padding-bottom: 14px;
|
|
|
- span {
|
|
|
+ span.item {
|
|
|
display: inline-block;
|
|
|
width: 111px;
|
|
|
height: 34px;
|
|
@@ -333,6 +412,10 @@ export default {
|
|
|
font-weight: 400;
|
|
|
color: #191A1E;
|
|
|
margin-bottom: 8px;
|
|
|
+ &--selected {
|
|
|
+ background-color: #3290C4;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|