ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<script lang="ts" setup>
import type { ActionItem, BasicColumn } from '@jnpf/ui/vxeTable';
 
import { computed, nextTick, onMounted, reactive } from 'vue';
 
import { useMessage } from '@jnpf/hooks';
import { BasicForm, useForm } from '@jnpf/ui/form';
import { usePopup } from '@jnpf/ui/popup';
import { BasicVxeTable, TableAction, useVxeTable } from '@jnpf/ui/vxeTable';
 
import dayjs from 'dayjs';
 
import { batchHandle, batchSign, getFlowBeforeList } from '#/api/workFlow/task';
import { getTreeList } from '#/api/workFlow/template';
import { useFlowState } from '#/hooks/flow/useFlowStatus';
import { $t } from '#/locales';
import { useBaseStore } from '#/store';
import FlowParser from '#/views/workFlow/components/FlowParser.vue';
 
interface State {
  listQuery: any;
  activeKey: string;
}
 
defineOptions({ name: 'WorkFlowFlowTodo' });
 
const state = reactive<State>({
  listQuery: {
    keyword: '',
    startTime: '',
    endTime: '',
    flowCategory: '',
    creatorUserId: '',
    templateId: '',
    flowUrgent: '',
  },
  activeKey: '',
});
const { createMessage, createConfirm } = useMessage();
const baseStore = useBaseStore();
const { flowUrgentList, getUrgentText, getUrgentTextColor, getHandlingStatusContent, getHandlingStatusColor } = useFlowState();
const [registerFlowParser, { openPopup: openFlowParser }] = usePopup();
const columns: BasicColumn[] = [
  { title: '流程标题', dataIndex: 'fullName', minWidth: 200, slots: { default: 'fullName' } },
  { title: '所属流程', dataIndex: 'flowName', minWidth: 150 },
  { title: '发起时间', dataIndex: 'startTime', width: 150, format: 'date|YYYY-MM-DD HH:mm:ss' },
  { title: '发起人员', dataIndex: 'creatorUser', width: 120 },
  { title: '审批节点', dataIndex: 'currentNodeName', width: 150 },
  { title: '紧急程度', dataIndex: 'flowUrgent', width: 100, align: 'center', slots: { default: 'flowUrgent' } },
  { title: '流程状态', dataIndex: 'status', width: 120, align: 'center', helpMessage: '流转:上个节点提交或同意的审批数据', slots: { default: 'status' } },
  { title: '接收时间', dataIndex: 'creatorTime', width: 150, format: 'date|YYYY-MM-DD HH:mm:ss' },
];
const tabList = [
  { fullName: '全部', id: '' },
  { fullName: '协办', id: 7 },
  { fullName: '退回', id: 5 },
  { fullName: '超时', id: -2 },
];
const [registerForm, { updateSchema }] = useForm({
  baseColProps: { span: 6 },
  showActionButtonGroup: true,
  showAdvancedButton: true,
  autoAdvancedLine: 2,
  compact: true,
  schemas: [
    {
      field: 'keyword',
      label: $t('common.keyword'),
      component: 'Input',
      componentProps: { placeholder: $t('common.enterKeyword'), submitOnPressEnter: true },
    },
    {
      field: 'pickerVal',
      label: '发起时间',
      component: 'DateRange',
      componentProps: {
        format: 'YYYY-MM-DD HH:mm:ss',
        showTime: { defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')] },
        placeholder: ['开始时间', '结束时间'],
      },
    },
    {
      field: 'flowCategory',
      label: '分类',
      component: 'Select',
      componentProps: { showSearch: true },
    },
    {
      field: 'templateId',
      label: '所属流程',
      component: 'TreeSelect',
      componentProps: { lastLevel: true },
    },
    {
      field: 'creatorUserId',
      label: '发起人员',
      component: 'UserSelect',
    },
    {
      field: 'flowUrgent',
      label: '紧急程度',
      component: 'Select',
      componentProps: { showSearch: true, options: flowUrgentList },
    },
  ],
  fieldMapToTime: [['pickerVal', ['startTime', 'endTime']]],
});
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys, redoHeight }] = useVxeTable({
  api: getFlowBeforeList,
  columns,
  rowSelection: { type: 'checkbox' },
  clickToRowSelect: false,
  clearSelectOnPageChange: true,
  actionColumn: {
    width: 50,
    title: '操作',
    dataIndex: 'action',
  },
});
 
const getSearchInfo = computed(() => ({ category: 1, ...state.listQuery }));
 
function getTableActions(record): ActionItem[] {
  return [
    {
      label: '办理',
      onClick: toDetail.bind(null, record),
    },
  ];
}
function toDetail(record) {
  const data = {
    id: record.taskId,
    flowId: record.flowId,
    opType: 2,
    operatorId: record.id,
  };
  openFlowParser(true, data);
}
function getFlowEngineList() {
  getTreeList().then((res) => {
    updateSchema({ field: 'templateId', componentProps: { options: res.data.list || [] } });
  });
}
async function getOptions() {
  const res = await baseStore.getDictionaryData('businessType');
  updateSchema({ field: 'flowCategory', componentProps: { options: res } });
  getFlowEngineList();
}
function handleSubmit(values) {
  state.listQuery = { status: state.listQuery.status, ...values };
  nextTick(() => reload());
}
function handleReset() {
  state.listQuery.keyword = '';
  state.listQuery.startTime = '';
  state.listQuery.endTime = '';
  state.listQuery.creatorUserId = '';
  state.listQuery.flowCategory = '';
  state.listQuery.templateId = '';
  state.listQuery.flowUrgent = '';
  nextTick(() => reload());
}
function onTabChange(val) {
  state.listQuery.status = val;
  nextTick(() => reload());
}
function handleBatch(type?) {
  const list: any[] = getSelectRows() || [];
  if (!list.length) return createMessage.error($t('common.selectDataTip'));
  const query: any = {
    ids: list.map((item) => item.id),
  };
  if (type == 'sign') query.type = 1;
  createConfirm({
    iconType: 'warning',
    title: $t('common.tipTitle'),
    content: type == 'sign' ? '确定退签,确定后进入我的待签' : '确定办理,办理后进入我的在办。',
    onOk: () => {
      const method = type == 'sign' ? batchSign : batchHandle;
      method(query).then((res) => {
        createMessage.success(res.msg);
        clearSelectedRowKeys();
        reload();
      });
    },
  });
}
 
onMounted(() => {
  getOptions();
});
</script>
<template>
  <div class="jnpf-content-wrapper">
    <div class="jnpf-content-wrapper-center">
      <div class="jnpf-content-wrapper-search-box">
        <BasicForm class="search-form" @advanced-change="redoHeight" @register="registerForm" @submit="handleSubmit" @reset="handleReset" />
      </div>
      <div class="jnpf-content-wrapper-content flex-flow-column bg-white">
        <a-tabs v-model:active-key="state.activeKey" class="jnpf-content-wrapper-tabs" @change="onTabChange">
          <a-tab-pane v-for="tab in tabList" :key="tab.id" :tab="tab.fullName" />
        </a-tabs>
        <BasicVxeTable @register="registerTable" :search-info="getSearchInfo">
          <template #tableTitle>
            <a-button type="primary" pre-icon="icon-ym icon-ym-btn-batch" @click="handleBatch">批量办理</a-button>
            <a-button type="warning" pre-icon="icon-ym icon-ym-btn-batch" @click="handleBatch('sign')" v-if="baseStore?.sysConfigInfo?.flowSign">
              批量退签
            </a-button>
          </template>
          <template #fullName="{ record }">
            <a-tag color="success" v-if="record.delegateUser">代理</a-tag>
            {{ record.fullName }}
          </template>
          <template #flowUrgent="{ record }">
            <JnpfTextTag :content="getUrgentText(record.flowUrgent)" :color="getUrgentTextColor(record.flowUrgent)" :show-tag="false" show-text-color />
          </template>
          <template #status="{ record }">
            <JnpfTextTag :content="getHandlingStatusContent(record.status)" :color="getHandlingStatusColor(record.status)" />
          </template>
          <template #action="{ record }">
            <TableAction :actions="getTableActions(record)" />
          </template>
        </BasicVxeTable>
      </div>
    </div>
    <FlowParser @register="registerFlowParser" @reload="reload" />
  </div>
</template>