Browse Source

修改会议记录模版

weicu
tanlongsheng 12 months ago
parent
commit
12436e13a6
  1. 62
      lib/data/services/db/sqflite_api.dart
  2. 27
      lib/data/services/network/api.dart
  3. 25
      lib/modules/meeting/views/template/template_edit_view.dart

62
lib/data/services/db/sqflite_api.dart

@ -222,31 +222,61 @@ class SqfliteApi {
for (var i = 0; i < data.length; i++) {
Map item = data[i];
int index = categoryList.indexOf(item['ttype']);
int categoryId = categoryList.length;
if (index == -1) {
categoryList.add(item['ttype']);
categoryId++;
await txn.insert('meetingcategorytemplate', {
'id': categoryId,
'name': item['ttype'],
});
}
await txn.insert('meetingtemplate', {
'categoryid': categoryId,
Map? result = categoryList.firstWhere(
(category) => category['name'] == item['ttype'],
orElse: () => null,
);
Map template = {
"id": item['id'],
'name': item['title'],
'icon': item['icon'],
'tag': item['tags'],
'tag': item['tags'] ?? '',
'desc': item['description'],
'outline': item['outline'],
'prompt': item['template'],
};
if (result != null) {
result['templates'].add(template);
} else {
categoryList.add({
'name': item['ttype'],
'templates': [template],
});
}
}
final int customIndex =
categoryList.indexWhere((e) => e['name'] == '自定义');
if (customIndex != -1) {
final customCategory = categoryList.removeAt(customIndex);
categoryList.add(customCategory);
} else {
categoryList.add({
'name': '自定义',
'templates': [],
});
}
if (!categoryList.contains('自定义')) {
for (var i = 0; i < categoryList.length; i++) {
Map item = categoryList[i];
int categoryId = i + 1;
await txn.insert('meetingcategorytemplate', {
'id': categoryList.length + 1,
'name': '自定义',
'id': categoryId,
'name': item['name'],
});
for (var j = 0; j < item['templates'].length; j++) {
Map template = item['templates'][j];
await txn.insert('meetingtemplate', {
"id": template['id'],
'categoryid': categoryId,
'name': template['name'],
'icon': template['icon'],
'tag': template['tag'],
'desc': template['desc'],
'outline': template['outline'],
'prompt': template['prompt'],
});
}
}
});
}

27
lib/data/services/network/api.dart

@ -189,4 +189,31 @@ class Api {
params: params,
);
}
//添加模版数据
static addEchomeetTemplates([params]) {
return DioManager().request(
NWMethod.post,
'/api/home/echomeet_addtemplate',
params: params,
);
}
//修改模版数据
static updateEchomeetTemplates([params]) {
return DioManager().request(
NWMethod.post,
'/api/home/echomeet_updatetemplate',
params: params,
);
}
//删除模版数据
static delEchomeetTemplates([params]) {
return DioManager().request(
NWMethod.post,
'/api/home/echomeet_deltemplate',
params: params,
);
}
}

25
lib/modules/meeting/views/template/template_edit_view.dart

@ -1,7 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../data/services/network/api.dart';
class TemplateEditView extends StatefulWidget {
const TemplateEditView({super.key});
@ -95,7 +98,9 @@ class _TemplateEditViewState extends State<TemplateEditView> {
onTap: () {
if (_nameController.text.isNotEmpty &&
_descController.text.isNotEmpty &&
_promptController.text.isNotEmpty) {}
_promptController.text.isNotEmpty) {
_submit();
}
},
child: Container(
height: 48.w,
@ -194,4 +199,22 @@ class _TemplateEditViewState extends State<TemplateEditView> {
],
);
}
void _submit() async {
EasyLoading.show();
Map data = {
"template": {
'ttype': '自定义',
'tags': '',
'icon': 'auto_fix_high',
'outline': '您将扮演一名会议事件归纳专家,能准确抓住会议中事件的关键点,并每个事件只需一句话精简总结。',
'title': _nameController.text,
'description': _descController.text,
'template': _promptController.text,
},
};
var response = await Api.addEchomeetTemplates(data);
if (response != null) {}
EasyLoading.dismiss();
}
}

Loading…
Cancel
Save