初始提交
This commit is contained in:
269
pages/workFlow/flowTodo/FlowMixin.js
Normal file
269
pages/workFlow/flowTodo/FlowMixin.js
Normal file
@@ -0,0 +1,269 @@
|
||||
/**
|
||||
* opType
|
||||
* -1 - 我发起的新建/编辑
|
||||
* 0 - 我发起的详情
|
||||
* 1 - 待签事宜
|
||||
* 2 - 待办事宜
|
||||
* 3 - 在办事宜
|
||||
* 4 - 已办事宜
|
||||
* 5 - 抄送事宜
|
||||
* 6 - 流程监控
|
||||
*/
|
||||
const statusMap = {
|
||||
1: [{
|
||||
name: '全部',
|
||||
status: ''
|
||||
},
|
||||
{
|
||||
name: '协办',
|
||||
status: '7'
|
||||
},
|
||||
{
|
||||
name: '退回',
|
||||
status: '5'
|
||||
},
|
||||
{
|
||||
name: '超时',
|
||||
status: '-2'
|
||||
}
|
||||
],
|
||||
2: [{
|
||||
name: '全部',
|
||||
status: ''
|
||||
},
|
||||
{
|
||||
name: '协办',
|
||||
status: '7'
|
||||
},
|
||||
{
|
||||
name: '退回',
|
||||
status: '5'
|
||||
},
|
||||
{
|
||||
name: '超时',
|
||||
status: '-2'
|
||||
}
|
||||
],
|
||||
3: [{
|
||||
name: '全部',
|
||||
status: ''
|
||||
},
|
||||
{
|
||||
name: '待提交',
|
||||
status: '0'
|
||||
},
|
||||
{
|
||||
name: '进行中',
|
||||
status: '1'
|
||||
},
|
||||
{
|
||||
name: '已完成',
|
||||
status: '2'
|
||||
}
|
||||
],
|
||||
4: [{
|
||||
name: '全部',
|
||||
status: ''
|
||||
},
|
||||
{
|
||||
name: '同意',
|
||||
status: '1'
|
||||
},
|
||||
{
|
||||
name: '拒绝',
|
||||
status: '2'
|
||||
},
|
||||
{
|
||||
name: '转审',
|
||||
status: '3'
|
||||
},
|
||||
{
|
||||
name: '加签',
|
||||
status: '4'
|
||||
},
|
||||
{
|
||||
name: '退回',
|
||||
status: '5'
|
||||
}
|
||||
],
|
||||
5: [{
|
||||
name: '全部',
|
||||
status: ''
|
||||
},
|
||||
{
|
||||
name: '已读',
|
||||
status: '1'
|
||||
},
|
||||
{
|
||||
name: '未读',
|
||||
status: '0'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
import {
|
||||
getOperatorList,
|
||||
getFlowLaunchList
|
||||
} from '@/api/workFlow/template'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mescrollTop: 206,
|
||||
statusList: [],
|
||||
tabsList: [{
|
||||
fullName: '在办',
|
||||
category: '2',
|
||||
key: 2,
|
||||
enCode: "workFlow.flowDoing"
|
||||
}, {
|
||||
fullName: '发起',
|
||||
category: null,
|
||||
key: 3,
|
||||
enCode: "workFlow.flowLaunch"
|
||||
}, {
|
||||
fullName: '已办',
|
||||
category: '3',
|
||||
key: 4,
|
||||
enCode: "workFlow.flowDone"
|
||||
}, {
|
||||
fullName: '抄送',
|
||||
category: '4',
|
||||
key: 5,
|
||||
enCode: "workFlow.flowCirculate"
|
||||
}],
|
||||
current: 0,
|
||||
subsectionIndex: 0,
|
||||
status: '',
|
||||
sysConfigInfo: {},
|
||||
menuList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
current: {
|
||||
handler(val) {
|
||||
if (this.sysConfigInfo.flowSign == 1 && val == 0) {
|
||||
this.statusList = []
|
||||
this.mescrollTop = 206 / 2
|
||||
return
|
||||
}
|
||||
this.statusList = statusMap[this.tabsList[val].key]
|
||||
this.mescrollTop = 322 / 2
|
||||
this.category = this.tabsList[this.current].category
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
},
|
||||
onLoad(e) {
|
||||
this.config = e?.data && JSON.parse(decodeURIComponent(e?.data))
|
||||
this.sysConfigInfo = uni.getStorageSync('sysConfigInfo') || {}
|
||||
this.addTabList()
|
||||
/* 从门户来到工作流 */
|
||||
if (e?.data) this.fromPortal()
|
||||
},
|
||||
methods: {
|
||||
addTabList() {
|
||||
const configToCheck = [{
|
||||
key: 'flowTodo',
|
||||
tab: {
|
||||
fullName: '待办',
|
||||
category: '1',
|
||||
key: 1,
|
||||
enCode: "workFlow.flowTodo"
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'flowSign',
|
||||
tab: {
|
||||
fullName: '待签',
|
||||
category: '0',
|
||||
key: 0,
|
||||
enCode: "workFlow.flowToSign"
|
||||
}
|
||||
}
|
||||
];
|
||||
configToCheck.forEach(config => {
|
||||
if (this.sysConfigInfo[config.key] === 1) return this.tabsList.unshift(config.tab);
|
||||
});
|
||||
this.menuList = uni.getStorageSync("menuList");
|
||||
let workFlowList = this.menuList.filter(o => o.enCode === 'workFlow')
|
||||
if (!workFlowList.length) return
|
||||
let menuData = workFlowList[0]?.children
|
||||
this.tabsList = this.tabsList.filter(tab =>
|
||||
menuData.some(menu => menu.enCode === tab.enCode)
|
||||
);
|
||||
},
|
||||
fromPortal() {
|
||||
let i = this.tabsList.findIndex(o => o.key === this.config.tabIndex)
|
||||
let item = this.tabsList[i]
|
||||
this.current = i;
|
||||
this.category = item?.category || null
|
||||
this.resetUpScroll()
|
||||
},
|
||||
/* tab1 */
|
||||
change(index) {
|
||||
let item = this.tabsList[index]
|
||||
this.current = index;
|
||||
this.status = ''
|
||||
this.keyword = ''
|
||||
this.subsectionIndex = 0
|
||||
this.category = item?.category || null
|
||||
this.resetUpScroll()
|
||||
},
|
||||
/* tab2 */
|
||||
subsection(e) {
|
||||
let item = this.statusList[e]
|
||||
this.status = item.status
|
||||
this.subsectionIndex = e
|
||||
this.resetUpScroll()
|
||||
},
|
||||
resetUpScroll() {
|
||||
this.$nextTick(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
/* 列表数据 */
|
||||
upCallback(page) {
|
||||
let methods = this.category ? getOperatorList : getFlowLaunchList;
|
||||
let query = {
|
||||
currentPage: page.num,
|
||||
pageSize: page.size,
|
||||
keyword: this.keyword,
|
||||
category: this.tabsList[this.current].category,
|
||||
status: this.status
|
||||
}
|
||||
methods(query, {
|
||||
load: page.num == 1
|
||||
}).then(res => {
|
||||
this.mescroll.endSuccess(res.data.list.length);
|
||||
if (page.num == 1) this.list = [];
|
||||
let flowStatus;
|
||||
const list = res.data.list.map(o => ({
|
||||
'flowStatus': this.getFlowStatus(o.status),
|
||||
'opType': this.setOpType(o.status),
|
||||
'swipeAction': this.swipeAction(o.status),
|
||||
...o
|
||||
}))
|
||||
this.list = this.list.concat(list);
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr();
|
||||
})
|
||||
},
|
||||
swipeAction(status) {
|
||||
let swipeAction = true
|
||||
if (this.tabsList[this.current].key === 3 && !this.category && (status == '0' || status == '9'))
|
||||
swipeAction = false
|
||||
return swipeAction
|
||||
},
|
||||
/* 设置opType */
|
||||
setOpType(status) {
|
||||
if (this.tabsList[this.current].key == 3) return status == '0' || status == '9' || status == '8' ? '-1' : 0
|
||||
if (this.tabsList[this.current].key == 0) return 1
|
||||
if (this.tabsList[this.current].key == 1) return 2
|
||||
if (this.tabsList[this.current].key == 2) return 3
|
||||
if (this.tabsList[this.current].key == 4) return 4
|
||||
if (this.tabsList[this.current].key == 5) return 5
|
||||
}
|
||||
}
|
||||
}
|
||||
180
pages/workFlow/flowTodo/flowList.vue
Normal file
180
pages/workFlow/flowTodo/flowList.vue
Normal file
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<view class="flowLaunch-v">
|
||||
<view class="flow-list" v-if="list.length > 0">
|
||||
<view class="flow-list-box">
|
||||
<SwipeItem :list="list" :buttons="options" @action="handleClick" ref="swipeItem" :marginB="20"
|
||||
:borderR="10">
|
||||
<template v-slot="{ item,index }">
|
||||
<view class="item" @click="goDetail(item)" :id="'item'+index" ref="mydom">
|
||||
<view class="item-left">
|
||||
<view class="item-left-top">
|
||||
<view class='common-lable-entrust' v-if="item.delegateUser">
|
||||
{{!category ? '委托' : '代理' }}
|
||||
</view>
|
||||
<view class='common-lable'
|
||||
:class="{'urgent-lable':item.flowUrgent==2,'important-lable':item.flowUrgent==3}">
|
||||
{{getLableValue(item.flowUrgent)}}
|
||||
</view>
|
||||
<text class="title u-font-28 u-line-1">{{item.fullName}}</text>
|
||||
</view>
|
||||
<text class="title u-line-1 u-font-24">审批节点:{{item.currentNodeName}}<text
|
||||
class="titInner">{{item.thisStep ? item.thisStep : ''}}</text></text>
|
||||
<text class="time title u-font-24">发起时间:<text
|
||||
class="titInner">{{item.startTime?$u.timeFormat(item.startTime, 'yyyy-mm-dd hh:MM:ss'):''}}</text></text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<image :src="item.flowStatus" mode="widthFix" class="item-right-img">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</SwipeItem>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
delFlowLaunch
|
||||
} from '@/api/workFlow/template'
|
||||
import SwipeItem from "@/components/SwipeItem/index"
|
||||
export default {
|
||||
name: "FlowList",
|
||||
components: {
|
||||
SwipeItem
|
||||
},
|
||||
props: {
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
swipeAction: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
category: {
|
||||
type: [String, Number],
|
||||
default: '0'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}],
|
||||
title: '',
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
open(index) {
|
||||
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
||||
// 原本为'false',再次设置为'false'会无效
|
||||
this.list[index].show = true;
|
||||
this.list.map((val, idx) => {
|
||||
if (index != idx) this.list[idx].show = false;
|
||||
})
|
||||
},
|
||||
goDetail(item) {
|
||||
const config = {
|
||||
opType: item.opType,
|
||||
operatorId: item.id,
|
||||
category: this.category,
|
||||
...item
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/workFlow/flowBefore/index?config=' +
|
||||
this.jnpf.base64.encode(JSON.stringify(config))
|
||||
})
|
||||
},
|
||||
handleClick(data) {
|
||||
const {
|
||||
index
|
||||
} = data
|
||||
const item = this.list[index]
|
||||
if ([1, 2, 3, 5].includes(item.status)) {
|
||||
this.$u.toast("流程正在审核,请勿删除")
|
||||
this.list[index].show = false
|
||||
return
|
||||
}
|
||||
delFlowLaunch(item.id).then(res => {
|
||||
this.$u.toast(res.msg)
|
||||
this.list.splice(index, 1)
|
||||
})
|
||||
},
|
||||
getLableValue(value) {
|
||||
var lableValue = ''
|
||||
switch (value) {
|
||||
case 1:
|
||||
lableValue = '普通'
|
||||
break;
|
||||
case 2:
|
||||
lableValue = '重要'
|
||||
break;
|
||||
case 3:
|
||||
lableValue = '紧急'
|
||||
break;
|
||||
default:
|
||||
lableValue = '普通'
|
||||
break;
|
||||
}
|
||||
return lableValue
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.flowLaunch-v {
|
||||
width: 100%;
|
||||
|
||||
.flow-list-box {
|
||||
width: 95%;
|
||||
|
||||
.item-left-top {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
|
||||
.common-lable {
|
||||
font-size: 24rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
margin-right: 8rpx;
|
||||
border-radius: 8rpx;
|
||||
color: #409EFF;
|
||||
border: 1px solid #409EFF;
|
||||
background-color: #e5f3fe;
|
||||
|
||||
&-entrust {
|
||||
margin-right: 8rpx;
|
||||
font-size: 24rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: #dbf1e1;
|
||||
color: #19be6b;
|
||||
border: 1px solid #19be6b;
|
||||
}
|
||||
}
|
||||
|
||||
.urgent-lable {
|
||||
color: #E6A23C;
|
||||
border: 1px solid #E6A23C;
|
||||
background-color: #fef6e5;
|
||||
}
|
||||
|
||||
.important-lable {
|
||||
color: #F56C6C;
|
||||
border: 1px solid #F56C6C;
|
||||
background-color: #fee5e5;
|
||||
}
|
||||
|
||||
.title {
|
||||
width: unset;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
172
pages/workFlow/flowTodo/index.vue
Normal file
172
pages/workFlow/flowTodo/index.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<view class="flow-v">
|
||||
<view class="notice-warp">
|
||||
<view class="search-box">
|
||||
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
|
||||
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
|
||||
</u-search>
|
||||
</view>
|
||||
<view class="flow-tabs">
|
||||
<u-tabs ref="tabs" :list="tabsList" active-color="#0177FF" inactive-color="#303133" font-size="30"
|
||||
v-model="current" name="fullName" @change="change" height="80" :is-scroll="false"></u-tabs>
|
||||
</view>
|
||||
<view class="flow-status-tabs" v-if="statusList.length">
|
||||
<u-subsection :list="statusList" :current="subsectionIndex" name="name" active-color="#2979FF"
|
||||
inactive-color="#999999" bg-color="#F2F3F7" font-size="24" :bold="false"
|
||||
@change="subsection"></u-subsection>
|
||||
</view>
|
||||
</view>
|
||||
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption"
|
||||
:up="upOption" :top="mescrollTop">
|
||||
<flowlist :list='list' :swipeAction='current != 3' :category='category' />
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import resources from '@/libs/resources.js'
|
||||
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
||||
import FlowMixin from "./FlowMixin.js";
|
||||
import flowlist from './flowList.vue'
|
||||
export default {
|
||||
components: {
|
||||
flowlist
|
||||
},
|
||||
mixins: [MescrollMixin, FlowMixin],
|
||||
data() {
|
||||
return {
|
||||
activeItemStyle: {
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
keyword: '',
|
||||
category: '0',
|
||||
list: [],
|
||||
downOption: {
|
||||
use: true,
|
||||
auto: true
|
||||
},
|
||||
upOption: {
|
||||
page: {
|
||||
num: 0,
|
||||
size: 20,
|
||||
time: null
|
||||
},
|
||||
empty: {
|
||||
use: true,
|
||||
icon: resources.message.nodata,
|
||||
tip: this.$t('common.noData'),
|
||||
fixed: true,
|
||||
top: "300rpx",
|
||||
},
|
||||
textNoMore: this.$t('app.apply.noMoreData')
|
||||
},
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
uni.$off('operate')
|
||||
uni.$on('refresh', () => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('refresh')
|
||||
},
|
||||
methods: {
|
||||
getFlowStatus(status) {
|
||||
let flowStatus;
|
||||
//待签收
|
||||
if (this.category == '0') flowStatus = resources.status.signfor
|
||||
// 待办,在办
|
||||
if (this.category == '1' || this.category == '2') {
|
||||
//流转中
|
||||
if (status == '1') flowStatus = resources.status.circulation
|
||||
//已退回
|
||||
if (status == '5') flowStatus = resources.status.back
|
||||
//协办
|
||||
if (status == '7') flowStatus = resources.status.assist
|
||||
//转审
|
||||
if (status == '3') flowStatus = resources.status.transfer
|
||||
//撤回
|
||||
if (status == '6') flowStatus = resources.status.recall
|
||||
//撤销中
|
||||
if (status == '8') flowStatus = resources.status.revoking
|
||||
//加签
|
||||
if (status == '2') flowStatus = resources.status.addSign
|
||||
//指派
|
||||
if (status == '4') flowStatus = resources.status.assign
|
||||
//转办
|
||||
if (status == '9') flowStatus = resources.status.transfer2
|
||||
}
|
||||
//发起
|
||||
if (!this.category) {
|
||||
//待提交
|
||||
if (status == '0') flowStatus = resources.status.draft
|
||||
//进行中
|
||||
if (status == '1') flowStatus = resources.status.doing
|
||||
//已通过
|
||||
if (status == '2') flowStatus = resources.status.adopt
|
||||
//已拒绝
|
||||
if (status == '3') flowStatus = resources.status.reject
|
||||
//已终止
|
||||
if (status == '4') flowStatus = resources.status.cancel
|
||||
//已暂停
|
||||
if (status == '5') flowStatus = resources.status.pause
|
||||
//撤销中
|
||||
if (status == '6') flowStatus = resources.status.revoking
|
||||
//已撤销
|
||||
if (status == '7') flowStatus = resources.status.revoke
|
||||
//退回
|
||||
if (status == '8') flowStatus = resources.status.back
|
||||
//撤回
|
||||
if (status == '9') flowStatus = resources.status.recall
|
||||
}
|
||||
//已办
|
||||
if (this.category == '3') {
|
||||
//转审
|
||||
if (status == '7') flowStatus = resources.status.transfer
|
||||
//同意
|
||||
if (status == '1') flowStatus = resources.status.agree
|
||||
//拒绝
|
||||
if (status == '0') flowStatus = resources.status.refuse
|
||||
//加签
|
||||
if (status == '5') flowStatus = resources.status.addSign
|
||||
//退回
|
||||
if (status == '3') flowStatus = resources.status.return
|
||||
//转办
|
||||
if (status == '18') flowStatus = resources.status.transfer2
|
||||
}
|
||||
//抄送
|
||||
if (this.category == '4') {
|
||||
//进行中
|
||||
if (status == '1') flowStatus = resources.status.doing
|
||||
//已通过
|
||||
if (status == '2') flowStatus = resources.status.adopt
|
||||
//已拒绝
|
||||
if (status == '3') flowStatus = resources.status.reject
|
||||
//已退回
|
||||
if (status == '8') flowStatus = resources.status.back
|
||||
}
|
||||
return flowStatus
|
||||
},
|
||||
search() {
|
||||
// 节流,避免输入过快多次请求
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.u-tabs {
|
||||
padding-bottom: 4rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user