Initial commit: 风影 OA 全栈源码(API/Web/Flutter/IM)
含 Phase 1.1 IM seq 排序、断线重连、多端已读同步与微信式语音转文字 UI。 排除 node_modules、构建产物、安装包与 .env 密钥。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../api/oa_client.dart';
|
||||
import '../labels.dart';
|
||||
import '../pages/record_detail_page.dart';
|
||||
import '../widgets/common.dart';
|
||||
|
||||
class FlowPage extends StatefulWidget {
|
||||
const FlowPage({super.key, required this.api});
|
||||
final OaClient api;
|
||||
|
||||
@override
|
||||
State<FlowPage> createState() => _FlowPageState();
|
||||
}
|
||||
|
||||
class _FlowPageState extends State<FlowPage> {
|
||||
List<Map<String, dynamic>> _items = [];
|
||||
String _bucket = '';
|
||||
bool _loading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_load();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
try {
|
||||
final q = <String, String>{};
|
||||
if (_bucket.isNotEmpty) q['bucket'] = _bucket;
|
||||
final data = await widget.api.get('/office/flow', query: q.isEmpty ? null : q);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_items = asMaps(data);
|
||||
_loading = false;
|
||||
});
|
||||
} catch (_) {
|
||||
if (mounted) setState(() => _loading = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('我的申请')),
|
||||
body: Column(
|
||||
children: [
|
||||
BucketBar(
|
||||
value: _bucket,
|
||||
extra: const [('occupying', '占用中')],
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
_bucket = v;
|
||||
_loading = true;
|
||||
});
|
||||
_load();
|
||||
},
|
||||
),
|
||||
if (_loading) const LinearProgressIndicator(minHeight: 2),
|
||||
Expanded(
|
||||
child: _items.isEmpty
|
||||
? const EmptyHint('还没有申请记录')
|
||||
: RefreshIndicator(
|
||||
onRefresh: _load,
|
||||
child: ListView.builder(
|
||||
itemCount: _items.length,
|
||||
itemBuilder: (_, i) {
|
||||
final r = _items[i];
|
||||
return KvTile(
|
||||
title: '${r['title'] ?? ''}',
|
||||
subtitle: '${zh(r['source'])} · ${zh(r['kind'])} ${fmtTime(r['createdAt'])}',
|
||||
status: r['status'],
|
||||
onTap: () => openRecord(context, widget.api, r),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user