262 lines
6.8 KiB
Vue
262 lines
6.8 KiB
Vue
<template>
|
||
<!-- 操作记录 列表 CM042 -->
|
||
<view class="risk-record-page">
|
||
<u-sticky>
|
||
<view class="filter-bar">
|
||
<view class="filter filter-date-range" @click="handleShowPicker({title: '时间区间', name: 'dateRange'})">
|
||
<text>{{dateFilterTxt}}</text>
|
||
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
|
||
</view>
|
||
<uni-search-bar class="search-bar" radius="100" v-model="keyword" @confirm="handleSearch"
|
||
@cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索" cancel-button="none">
|
||
<uni-icons slot="searchIcon" color="#999999" size="16" type="search" class="search-slot" />
|
||
</uni-search-bar>
|
||
<view class="filter filter-status" @click="handleShowPicker({title: '状态', name: 'status'})">
|
||
<text>{{statusFilterTxt}}</text>
|
||
<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
|
||
</view>
|
||
</view>
|
||
</u-sticky>
|
||
|
||
<view class="main">
|
||
<view class="content-list">
|
||
<common-card :dataSource="item" v-for="item in lists" @click="showDetail(item.ID)">
|
||
<view class="content">
|
||
<view class="field">
|
||
<text class="left">操作人:</text>
|
||
<text class="value">{{item.Nav_User.NAME}}</text>
|
||
</view>
|
||
<view class="field">
|
||
<text class="left">操作类型:</text>
|
||
<text class="value">{{item.OPERATETYPE_SHOW}}</text>
|
||
</view>
|
||
<view class="field">
|
||
<text class="left">操作时间:</text>
|
||
<text class="value">{{item.CREATE_TIME}}</text>
|
||
</view>
|
||
</view>
|
||
</common-card>
|
||
</view>
|
||
<view v-if="!lists.length" class="empty-wrap">
|
||
<u-empty text="暂无数据" icon="/static/empty@2x.png">
|
||
</u-empty>
|
||
</view>
|
||
</view>
|
||
<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
|
||
@cancel="closePicker"></u-picker>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
initFilter,
|
||
extendRule,
|
||
extendInclude
|
||
} from '../../../../utils/common'
|
||
|
||
import {
|
||
OrderPagedOperate
|
||
} from '../../../../services/apply/subPages/SCCM/emergency'
|
||
|
||
import {
|
||
getEnum
|
||
} from '../../../../services/common'
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
pageIndex: 0,
|
||
lists: [{
|
||
Nav_User: {
|
||
NAME: ''
|
||
},
|
||
OPERATETYPE_SHOW: ''
|
||
}],
|
||
enums: [{
|
||
ID: '',
|
||
NAME: ''
|
||
}],
|
||
currentTab: 0,
|
||
text: '',
|
||
total: '',
|
||
keyword: '',
|
||
searchStartTime: '',
|
||
filterStatus: null,
|
||
dateFilterTxt: '时间区间',
|
||
statusFilterTxt: '类型筛选',
|
||
comPickerInfo: {
|
||
showPicker: false,
|
||
columns: [],
|
||
title: '',
|
||
name: ''
|
||
}
|
||
}
|
||
},
|
||
onLoad() {
|
||
this.ini()
|
||
},
|
||
methods: {
|
||
// handleTab(t) {
|
||
// this.currentTab = t
|
||
// },
|
||
handleSearch() {
|
||
this.pageIndex = 0
|
||
this.loadData(false)
|
||
},
|
||
ini() {
|
||
getEnum({
|
||
name: 'CMOperation'
|
||
}).then(res => {
|
||
var listEnums = res
|
||
this.enums = listEnums
|
||
this.loadData()
|
||
})
|
||
},
|
||
loadData(paginate) {
|
||
this.pageIndex++
|
||
const orgId = uni.getStorageSync('orgId')
|
||
let json = initFilter(orgId, "", "CREATE_TIME", 1, this.pageIndex);
|
||
extendInclude(json, 'Nav_User')
|
||
if (this.keyword) {
|
||
extendRule(json, 'Nav_User.NAME', 9, this.keyword);
|
||
}
|
||
if (this.searchStartTime && this.searchStartTime.length > 0) {
|
||
extendRule(json, 'CREATE_TIME', 6, this.searchStartTime)
|
||
}
|
||
if (this.filterStatus !== null) {
|
||
extendRule(json, 'OPERATETYPE', 1, this.filterStatus)
|
||
}
|
||
|
||
OrderPagedOperate(json).then(res => {
|
||
this.total = res.TotalCount
|
||
const newRes = (res.Data || []).map(i => {
|
||
return {
|
||
...i,
|
||
title: i.CODE,
|
||
OPERATETYPE_SHOW: (this.enums && this.enums.length > 0) ? (this.enums.find(e =>
|
||
e.ID == i.OPERATETYPE).NAME) : i.OPERATETYPE
|
||
}
|
||
})
|
||
if (paginate) {
|
||
this.lists = this.lists.concat(newRes)
|
||
} else {
|
||
this.lists = newRes
|
||
}
|
||
})
|
||
},
|
||
showDetail(id) {
|
||
uni.navigateTo({
|
||
url: 'operateRecord?ID=' + id + '&enums=' + JSON.stringify(this.enums)
|
||
})
|
||
},
|
||
|
||
handleShowPicker(p) {
|
||
let column = []
|
||
if (p.name === 'dateRange') {
|
||
column = ['全部', '当天', '最近三天', '最近一周', '最近一月']
|
||
}
|
||
if (p.name === 'status') {
|
||
// column = ['全部', '草稿', '确认中', '签到中', '审批中', '归档', '审批驳回']
|
||
if (this.enums && this.enums.length > 0) {
|
||
// column.push({'name':'类型筛选','ID':0} )
|
||
column.push('类型筛选')
|
||
this.enums.forEach(e => {
|
||
column.push(e.NAME)
|
||
// column.push({'name':e.NAME,'ID':e.ID} )
|
||
|
||
})
|
||
}
|
||
}
|
||
|
||
this.comPickerInfo = {
|
||
showPicker: true,
|
||
title: p.title,
|
||
name: p.name,
|
||
columns: [column]
|
||
}
|
||
},
|
||
onConfirmPicker(e) {
|
||
if (this.comPickerInfo.name === 'dateRange') {
|
||
let currentDate = new Date();
|
||
if (e.indexs[0] === 2) {
|
||
currentDate.setDate(currentDate.getDate() - 3);
|
||
} else if (e.indexs[0] === 3) {
|
||
currentDate.setDate(currentDate.getDate() - 7);
|
||
} else if (e.indexs[0] === 4) {
|
||
currentDate.setMonth(currentDate.getMonth() - 1);
|
||
}
|
||
if (e.indexs[0] === 0) {
|
||
this.searchStartTime = ''
|
||
this.dateFilterTxt = '时间区间'
|
||
} else {
|
||
this.dateFilterTxt = e.value[0]
|
||
this.searchStartTime = uni.$u.timeFormat(currentDate, 'yyyy-mm-dd 00:00:00');
|
||
}
|
||
}
|
||
if (this.comPickerInfo.name === 'status') {
|
||
// 草稿 = 0, 确认中:5 签到中 = 6, 审批中 = 10, 归档 = 20, 审批驳回 = 30,
|
||
// if (e.indexs[0] === 1) {
|
||
// this.filterStatus = 0
|
||
// } else if (e.indexs[0] === 2) {
|
||
// this.filterStatus = 5
|
||
// } else if (e.indexs[0] === 3) {
|
||
// this.filterStatus = 6
|
||
// } else if (e.indexs[0] === 4) {
|
||
// this.filterStatus = 10
|
||
// } else if (e.indexs[0] === 5) {
|
||
// this.filterStatus = 20
|
||
// } else if (e.indexs[0] === 6) {
|
||
// this.filterStatus = 30
|
||
// }
|
||
|
||
if (e.indexs[0] === 0) {
|
||
// 全部
|
||
this.filterStatus = null
|
||
this.statusFilterTxt = '类型筛选'
|
||
} else {
|
||
this.filterStatus = this.enums[e.indexs[0] - 1].ID
|
||
this.statusFilterTxt = e.value[0]
|
||
}
|
||
}
|
||
this.closePicker()
|
||
},
|
||
closePicker() {
|
||
this.comPickerInfo = {
|
||
showPicker: false,
|
||
columns: [],
|
||
title: '',
|
||
name: ''
|
||
}
|
||
},
|
||
},
|
||
computed: {
|
||
|
||
},
|
||
onReachBottom() {
|
||
if (this.total > 10 * this.pageIndex)
|
||
this.loadData(true)
|
||
},
|
||
watch: {
|
||
keyword(n, o) {
|
||
this.pageIndex = 0
|
||
this.keyword = n
|
||
this.loadData()
|
||
},
|
||
searchStartTime(n, o) {
|
||
this.pageIndex = 0
|
||
this.searchStartTime = n
|
||
this.loadData()
|
||
},
|
||
filterStatus(n, o) {
|
||
this.pageIndex = 0
|
||
this.filterStatus = n
|
||
this.loadData()
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
|
||
<style>
|
||
@import url("../../../../style/css/listTemplate.css");
|
||
</style> |