开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 142

撸码小分队/DS

forked from Vanishi/DS
加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (4)
master
V1.0
DS.v1.7.x64.2023年04月16日
DS.v1.6.x64.2023年04月13日
DS.v1.5.x64.2023年04月08日
DS.v1.0.x64.2023年03月18日
DS
/
Run
/
RunDialog.cpp
DS
/
Run
/
RunDialog.cpp
RunDialog.cpp 45.06 KB
一键复制 编辑 原始数据 按行查看 历史
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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147
#include "RunDialog.h"
#include "Utils/models.h"
#include "Utils/database.h"
#include "Utils/ComLoadingLabel.h"
#include "Utils/ComLineWidget.h"
#include "Utils/ComMessageBox.h"
#include "TaskFlow/mFcModels.h"
#include "Task/TaskDataExportDialog.h"
#include "RunHelper.h"
#include "RunWebEngineView.h"
#include "RunWebEngineViewManager.h"
#include "RunThreadPipline.h"
#include "style.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QToolButton>
#include <QPushButton>
#include <QStackedWidget>
#include <QTableWidget>
#include <QHeaderView>
#include <QScrollBar>
#include <QCloseEvent>
#include <QTimer>
#include <QWebEngineHttpRequest>
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
#include <QtCore5Compat>
#endif
#include <QsLog.h>
const static int WAIT_SLEEP_UNIT = 1000; // 执行前,休眠单位:毫秒
const static int PAGESIZE = 10; // 执行页面的数据分页数
RunDialog::RunDialog(MTask *task) : QDialog(nullptr), mTask(task){
QLOG_INFO() << "RunDialog::RunDialog()";
Qt::WindowFlags flags=Qt::Dialog;
flags |=Qt::WindowMinMaxButtonsHint;
flags |=Qt::WindowCloseButtonHint;
setWindowFlags(flags);
resize(1000,600);
setAttribute(Qt::WA_StyledBackground,true);
setStyleSheet(QString(".RunDialog{background-color:%1;}").arg(m_rgb_basic));
setWindowTitle(mTask->name);
mHelper = new RunHelper(this);
mThreadPipline = new RunThreadPipline(this);
connect(mThreadPipline,&RunThreadPipline::notifyJobFinished,this,&RunDialog::onThreadPiplineJobFinished);
connect(mThreadPipline,&RunThreadPipline::notifyUpdateData,this,&RunDialog::onThreadPiplineUpdateData,Qt::QueuedConnection);
connect(mThreadPipline,&RunThreadPipline::notifyAlert,this,&RunDialog::onThreadPiplineAlert);
connect(this,&RunDialog::notifyPiplinePushData,mThreadPipline,&RunThreadPipline::onPushData,Qt::QueuedConnection);
mMessage = new RunMessage(this);
// init UI
boxLayout = new QVBoxLayout(this);
boxLayout->setContentsMargins(0,0,0,0);
boxLayout->setSpacing(0);
initTopMenuUi();
initWebViewUi();
initBottomUi();
mWebViewManager = new RunWebEngineViewManager(this);//默认打开一个webview
// 默认加载 '打开网页'
addrLine->setText(mTask->addressList[0]);
addrLine->setCursorPosition(0);
mWebViewManager->getCurrentWebView()->load(QUrl(addrLine->text()));
// // 默认以数据库的字段显示
mFields = Database::getInstance()->getTableFields(task->code);
// // 设置header(这里是数据库的字段名称为准)
tableWidget->setColumnCount(mFields.length());
tableWidget->setHorizontalHeaderLabels(mFields);
exportBtn->show();
startBtn->show();
if(Database::getInstance()->getTaskData(mTask->code)){
// 存在数据
tableStateBtn->setArrowType(Qt::ArrowType::DownArrow);
getData();
tableWidget->show();
}
if(mTask->runParams.isLoop){
//开启循环采集
sendStartJobCommand();
}
}
RunDialog::~RunDialog(){
QLOG_INFO() << "RunDialog::~RunDialog()";
if(mThreadPipline){
delete mThreadPipline;
mThreadPipline = nullptr;
}
if(mHelper){
delete mHelper;
mHelper = nullptr;
}
if(mMessage){
delete mMessage;
mMessage = nullptr;
}
if(mWebViewManager){
delete mWebViewManager;
mWebViewManager = nullptr;
}
if(mTask){
delete mTask;
mTask = nullptr;
}
}
RunHelper *RunDialog::getHelper(){
return mHelper;
}
MTask *RunDialog::getTask(){
return mTask;
}
void RunDialog::closeEvent(QCloseEvent *event){
if(mThreadPipline->jobFinished){
event->accept();
}else{
event->ignore();
ComMessageBox::error(this,"任务执行中,无法关闭窗口,需要先停止采集");
}
}
void RunDialog::startNextStep(QString lastStepID){
if(mThreadPipline->jobCommandState){
MFlowStepParams *np = mHelper->getNextStepParams(lastStepID);
lastStepID.clear();
if(np){
QLOG_INFO() << QString("RunDialog startNextStep() name=%1").arg(np->name);
QString menuType = np->menuType;
if(MCONSTANT_FLOW_MENU_TYPE_OpenWebBtn==menuType){
startOpenWeb(static_cast<MFlowStepParamsOpenWeb *>(np));
}else if(MCONSTANT_FLOW_MENU_TYPE_ClickEleBtn==menuType){
startClickEle(static_cast<MFlowStepParamsClickEle *>(np));
}else if(MCONSTANT_FLOW_MENU_TYPE_ExtractBtn==menuType){
startExtract(static_cast<MFlowStepParamsExtract *>(np));
}else if(MCONSTANT_FLOW_MENU_TYPE_InputBtn==menuType){
startInput(static_cast<MFlowStepParamsInput *>(np));
}else if(MCONSTANT_FLOW_MENU_TYPE_LoopBtn==menuType){
startLoopHead(static_cast<MFlowStepParamsLoop *>(np));
}else if(MCONSTANT_FLOW_MENU_TYPE_MouseBtn==menuType){
startMouse(static_cast<MFlowStepParamsMouse *>(np));
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"暂不支持的窗体!");
return ;
}
}else {
sendStopJobCommand(RunMessage::MessageType::SUCCESS,"本次执行成功");
return ;
}
}
}
void RunDialog::startOpenWeb(MFlowStepParamsOpenWeb *params){
QString url = params->url;
if(params->carryParent!=nullptr){//当前步骤存在父窗体
if(params->carryParent->menuType==MCONSTANT_FLOW_MENU_TYPE_LoopBtn){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
url = ploop->carryAddressList[ploop->carryAddressCurrent-1];
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"打开网页所属循环必须是网址列表循环,否则循环无意义!");
return ;
}
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"(01x)暂不支持if窗体!");
return ;
}
}
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,url,params](){
addrLine->setText(url);
QWebEngineHttpRequest request;
QUrl qurl(url);
request.setUrl(qurl);
request.setMethod(QWebEngineHttpRequest::Get);
// request.setHeader(QByteArray("Cache-Control"),QByteArray("no-cache"));
// request.setHeader(QByteArray("Pragma"),QByteArray("no-cache"));
// QWebEngineCookieStore* cookieStore = m_currentWebView->page()->profile()->cookieStore();
// cookieStore->deleteAllCookies();
// cookieStore->setCookie(QNetworkCookie("a","b"),qurl);
// cookieStore->setCookie(QNetworkCookie("c","d"),qurl);
mWebViewManager->getCurrentWebView()->load(request);
QTimer *timer = new QTimer();
connect(timer,&QTimer::timeout,this,[this,timer,params](){
if(mWebViewManager->pageIsFinished){
timer->stop();
delete timer;
// 判断是否滚动
if(params->isRoll){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(QString("startRoll('%1','%2','%3')").arg(params->rollCount).arg(params->rollInterval).arg(params->rollTypeIndex),
[this,params](const QVariant &v) {
QString rf = v.toString();
if(rf.startsWith("success")){
endOpenWeb(params);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"(01x)打开网页滚动反馈出错!");
return ;
}
});
}else{
endOpenWeb(params);
}
}
});
timer->start(50);
});
}
void RunDialog::startClickEle(MFlowStepParamsClickEle *params){
QString iloopTypeName;
QString iloopTypeValue;
int inum = 0;
bool iisLast = false;// false:不属于循环最后一步 true:属于循环最后一步
if(params->carryParent!=nullptr){//当前步骤存在父窗体
if(params->carryParent->menuType==MCONSTANT_FLOW_MENU_TYPE_LoopBtn){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
iloopTypeName = ploop->loopTypeName;
iloopTypeValue = ploop->loopTypeValue;
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){//最后步骤
iisLast = true;
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
//循环翻页(一定是单独点击)
inum = 0;
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
// 网址列表的循环中,最后步骤的点击,一定是单独点击
QLOG_INFO() << QString("Run.cpp startClickEle() carryAddressCurrent=%1, carryAddressTotal=%2").arg(ploop->carryAddressCurrent).arg(ploop->carryAddressTotal);
inum = 0;
}else {
// 固定元素,非固定元素
QLOG_INFO() << QString("Run.cpp startClickEle() carryCurrent=%1, carryTotal=%2").arg(ploop->carryCurrent).arg(ploop->carryTotal);
inum = ploop->carryCurrent;
}
}else {// 非最后步骤
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
// 单个元素的循环中,存在中间步骤的点击,一定是单独点击
inum = 0;
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
// 网址列表的循环中,存在中间步骤的点击,一定是单独点击
inum = 0;
}else {
inum = ploop->carryCurrent;
}
}
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"(02x)暂不支持if窗体!");
return ;
}
}else {// 不属于循环的点击,一定是单独点击
inum = 0;
}
if(params->eleXpath=="" && params->eleXpath==""){
// 自定义拖拽的按钮,不需要执行网页点击,通常用于延迟和滚动至网页底部
startClickEleRoll(params,"success:wait100,[自定义的点击按钮]");
}else{
QString script = QString("startClickEle('%1','%2','%3','%4','%5','%6','%7','%8','%9')").
arg(iloopTypeName).arg(iloopTypeValue).arg(inum).arg(params->eleXpath).arg(params->eleText).arg(params->isLoop).arg(params->isNewTab).
arg(iisLast).arg(params->isTurnPage);
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,script,params](){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(script,[this,params](const QVariant &v) {
QString feedback = v.toString();
QLOG_INFO() << QString("Run.cpp startClickEle() feedback=%1").arg(feedback);
if(feedback.startsWith("success")){
startClickEleRoll(params,feedback);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"(02x0001)点击元素失败,请确认规则后重试!");
return ;
}
});
});
}
}
void RunDialog::startClickEleRoll(MFlowStepParamsClickEle *params, QString feedback){
QStringList rps = feedback.mid(8).split(",");
QString p1 = rps[0];// dropdown,wait100,wait300
bool clickNext= rps[1]=="next"?true:false;// 点击元素之后后,是否存在next返回值(存在next表示:循环翻页存在下一页或者 下拉刷新存在下一页)
feedback.clear();
if("dropdown"==p1) {
// 页面内下拉刷新
if(params->isRoll){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(QString("startRoll('%1','%2','%3')").arg(params->rollCount).arg(params->rollInterval).arg(params->rollTypeIndex),
[this,params](const QVariant &v) {
QString rf = v.toString();
QLOG_INFO() << QString("Run.cpp startClickEleRoll() dropdown.rf=%1").arg(rf);
if(rf.startsWith("success")){
bool clickRollNext = rf.mid(8).startsWith("next")?true:false; // next 滚动存在,bottom 滚动已经到底部
endClickEle(params,clickRollNext);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"(02x0015)点击元素滚动反馈出错!");
return ;
}
});
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"(02x0010)页面内下拉刷新规则错误!");
return ;
}
}else{
// wait100,wait200,,,
int wait = p1.mid(4).toInt();// 休眠的毫秒
QTimer::singleShot(wait,this,[this,params,clickNext](){
QTimer *timer = new QTimer();
connect(timer,&QTimer::timeout,this,[this,timer,params,clickNext](){
if(mWebViewManager->pageIsFinished){
timer->stop();
delete timer;
if(params->isRoll){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(QString("startRoll('%1','%2','%3')").arg(params->rollCount).arg(params->rollInterval).arg(params->rollTypeIndex),
[this,params,clickNext](const QVariant &v) {
QString rf = v.toString();
if(rf.startsWith("success")){
endClickEle(params,clickNext);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"(02x0016)点击元素滚动反馈出错!");
return ;
}
});
}else{
endClickEle(params,clickNext);
}
}
});
timer->start(50);
});
}
}
void RunDialog::startExtract(MFlowStepParamsExtract * params){
QString iloopTypeName;
QString iloopTypeValue;
int inum=0;
if(params->carryParent!=nullptr){//当前步骤存在父窗体
if(params->carryParent->menuType==MCONSTANT_FLOW_MENU_TYPE_LoopBtn){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
iloopTypeName = ploop->loopTypeName;
iloopTypeValue = ploop->loopTypeValue;
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){// 最后步骤
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
sendStopJobCommand(RunMessage::MessageType::ERROR,"(03x)提取不能作单个元素循环的的最后一步,规则错误!");
return ;
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
// 网址列表的循环中,最后步骤的提取,一定是单独提取
QLOG_INFO() << QString("Run.cpp startExtract() carryAddressCurrent=%1,carryAddressTotal=%2").arg(ploop->carryAddressCurrent).arg(ploop->carryAddressTotal);
inum = 0;
}else { // 固定或非固定
QLOG_INFO() << QString("Run.cpp startExtract() carryCurrent=%1,carryTotal=%2").arg(ploop->carryCurrent).arg(ploop->carryTotal);
inum = ploop->carryCurrent;
}
}else {// 非最后步骤
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
// 单个元素的循环中,存在中间步骤的提取,一定是单独提取
inum = 0;
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
// 网址列表的循环中,存在中间步骤的提取,一定是单独提取
inum = 0;
}else { // 固定或非固定
inum = ploop->carryCurrent;
}
}
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"(03x)暂不支持if窗体!");
return ;
}
}else {//循环之外
inum = 0;
}
QString script = QString("startExtract('%1','%2','%3','%4','%5')").
arg(iloopTypeName).arg(iloopTypeValue).arg(inum).arg(params->isLoop).arg(params->carryFields);
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,script,params](){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(script, [this,params](const QVariant &v) {
QString feedback = v.toString();
if(feedback.startsWith("success")){
endExtract(params,feedback);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"提取字段失败,请确认规则后重试!");
return ;
}
});
});
}
void RunDialog::startInput(MFlowStepParamsInput *params){
QString iloopTypeName;
QString iloopTypeValue;
int inum=0;
if(params->carryParent!=nullptr){//当前步骤存在父窗体
if(params->carryParent->menuType==MCONSTANT_FLOW_MENU_TYPE_LoopBtn){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
iloopTypeName = ploop->loopTypeName;
iloopTypeValue = ploop->loopTypeValue;
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){// 最后步骤
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
sendStopJobCommand(RunMessage::MessageType::ERROR,"输入文字不能作单个元素循环的的最后一步,规则错误!");
return ;
}
}
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"(04x)暂不支持if窗体!");
return ;
}
}
QString script = QString("startInput('%1','%2','%3','%4','%5','%6')").arg(iloopTypeName).arg(iloopTypeValue).arg(inum).
arg(params->eleXpath).arg(params->inputText).arg(params->isLoop);
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,script,params](){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(script,[this,params](const QVariant &v) {
QString feedback = v.toString();
QLOG_INFO() << QString("Run.cpp startInput() feedback=%1").arg(feedback);
if(feedback.startsWith("success")){
endInput(params);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"输入文字失败,请确认规则后重试!");
return ;
}
});
});
}
void RunDialog::startLoopHead(MFlowStepParamsLoop * params){
QLOG_INFO() << "RunDialog startLoopHead() begin";
if (params->loopTypeName==MCONSTANT_RADIO_SINGLE) {
// 单个元素 => 循环翻页 直接进入下一步
params->carrySingleCurrent = 1;
startNextStep(params->stepID);
}else if (params->loopTypeName==MCONSTANT_RADIO_SITEADDRESS) {
// 网址列表 => 循环执行网址列表
QStringList addressList = params->loopTypeValue.split(",");
params->carryAddressList = addressList;
params->carryAddressTotal =addressList.length();
params->carryAddressCurrent = 1;
startNextStep(params->stepID);
}else if (params->loopTypeName==MCONSTANT_RADIO_FIXED || params->loopTypeName==MCONSTANT_RADIO_UNFIXED) {
// 固定 非固定循环
QString script = QString("startLoopHead('%1','%2')").arg(params->loopTypeName,params->loopTypeValue);
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,params,script](){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(script,[this,params](const QVariant &v) {
QString feedback = v.toString();
QLOG_INFO() << QString("Run.cpp startLoopHead() feedback=%1").arg(feedback);
if(feedback.startsWith("success")){
int total = feedback.mid(8).toInt();
if(params->isEndLoopWithTimes){//限制循环次数,则以最小循环次数为准
if(params->endLoopTimes<total){
total = params->endLoopTimes;
}
}
params->carryTotal = total;
params->carryCurrent = 1;
params->carryCurrentWebView = mWebViewManager->getCurrentWebView();
startNextStep(params->stepID);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"获取循环失败,请确认规则后重试!");
return ;
}
});
});
}
}
void RunDialog::startLoopTail(QString loopStepID,QString loopInnerLastStepID){
QLOG_INFO() << "RunDialog startLoopTail() begin";
MFlowStepParamsLoop * params = static_cast<MFlowStepParamsLoop *>(mHelper->m_stepsH[loopStepID]);
if(params->carryParent!=nullptr){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
sendStopJobCommand(RunMessage::MessageType::ERROR,"(07x)循环不能作(单个元素循环)的的最后一步,请修改规则!");
return ;
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
if(ploop->carryAddressCurrent < ploop->carryAddressTotal){
ploop->carryAddressCurrent+=1;
//循环的外层循环周期 未结束,重新进入外层循环的第一步
startNextStep(ploop->stepID);
}else{//循环的外层循环周期 已结束,则判断是否有必要进入循环的外层循环tail
if(ploop->carryParent!=nullptr){
startLoopTail(ploop->carryParent->stepID,ploop->stepID);
}else{
startNextStep(loopInnerLastStepID);
}
}
}else{
emit mWebViewManager->cleanWebViews(ploop->carryCurrentWebView);
if(ploop->carryCurrent < ploop->carryTotal){
ploop->carryCurrent+=1;
//循环的外层循环周期 未结束,重新进入外层循环的第一步
startNextStep(ploop->stepID);
}else{//循环的外层循环周期 已结束,则判断是否有必要进入循环的外层循环tail
if(ploop->carryParent!=nullptr){
startLoopTail(ploop->carryParent->stepID,ploop->stepID);
}else{
startNextStep(loopInnerLastStepID);
}
}
}
}else{
//该循环所属的循环,不在最后一步,则继续向前即可
startNextStep(loopInnerLastStepID);
}
}else{
//该循环不在循环内,直接进入innerLast 的下一步
startNextStep(loopInnerLastStepID);
}
}
void RunDialog::startMouse(MFlowStepParamsMouse *params){
QString iloopTypeName;
QString iloopTypeValue;
int inum=0;
if(params->carryParent!=nullptr){//当前步骤存在父窗体
if(params->carryParent->menuType==MCONSTANT_FLOW_MENU_TYPE_LoopBtn){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
iloopTypeName = ploop->loopTypeName;
iloopTypeValue = ploop->loopTypeValue;
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){// 最后步骤
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
sendStopJobCommand(RunMessage::MessageType::ERROR,"移动鼠标不能作单个元素循环的的最后一步,规则错误!");
return ;
}
}
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"(08x)暂不支持if窗体!");
return ;
}
}
QString script = QString("startMouse('%1','%2','%3','%4','%5')").arg(iloopTypeName).arg(iloopTypeValue).arg(inum).
arg(params->eleXpath).arg(params->isLoop);
QTimer::singleShot(WAIT_SLEEP_UNIT*params->waitSleep,this,[this,script,params](){
mWebViewManager->getCurrentWebView()->page()->runJavaScript(script,[this,params](const QVariant &v) {
QString feedback = v.toString();
QLOG_INFO() << QString("Run.cpp startMouse() feedback=%1").arg(feedback);
if(feedback.startsWith("success")){
endMouse(params);
}else{
sendStopJobCommand(RunMessage::MessageType::ERROR,"移动鼠标失败,请确认规则后重试!");
return ;
}
});
});
}
void RunDialog::endOpenWeb(MFlowStepParamsOpenWeb *params){
if(params->carryParent!=nullptr){
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
sendStopJobCommand(RunMessage::MessageType::ERROR,"打开网页不能作循环最后一步!");
return ;
}else {//第一步或者中间步骤,继续向前
startNextStep(params->stepID);
}
}else {//循环之外
startNextStep(params->stepID);
}
}
void RunDialog::endClickEle(MFlowStepParamsClickEle * params,bool next ){
QString lastStepID = params->stepID;
if(params->carryParent!=nullptr){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
if(ploop->loopTypeName==MCONSTANT_RADIO_SINGLE){
if(next){// 点击翻页存在下一页 或 下拉刷新执行成功
ploop->carrySingleCurrent+=1;
if(ploop->isEndLoopWithTimes){
if(ploop->carrySingleCurrent>=ploop->endLoopTimes){
// 点击翻页满足循环次数结束
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}
lastStepID = ploop->stepID;
}else{
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}else if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
if(ploop->carryAddressCurrent<ploop->carryAddressTotal){
ploop->carryAddressCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}else {
emit mWebViewManager->cleanWebViews(ploop->carryCurrentWebView);
if(ploop->carryCurrent<ploop->carryTotal){
ploop->carryCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}
}
}
startNextStep(lastStepID);
}
void RunDialog::endExtract(MFlowStepParamsExtract * params,QString feedback){
QString res = feedback.mid(8);
emit this->notifyPiplinePushData(params->stepID,res);
feedback.clear();
QString lastStepID = params->stepID;
if(params->carryParent!=nullptr){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
// 提取不能作为循环的最后一步
if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
if(ploop->carryAddressCurrent<ploop->carryAddressTotal){
ploop->carryAddressCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}else {
emit mWebViewManager->cleanWebViews(ploop->carryCurrentWebView);
if(ploop->carryCurrent<ploop->carryTotal){
ploop->carryCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}
}
}
startNextStep(lastStepID);
}
void RunDialog::endInput(MFlowStepParamsInput *params){
QString lastStepID = params->stepID;
if(params->carryParent!=nullptr){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
// 文本输入不能作为单元素循环的最后一步
if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
if(ploop->carryAddressCurrent<ploop->carryAddressTotal){
ploop->carryAddressCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}else {
emit mWebViewManager->cleanWebViews(ploop->carryCurrentWebView);
if(ploop->carryCurrent<ploop->carryTotal){
ploop->carryCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}
}
}
startNextStep(lastStepID);
}
void RunDialog::endMouse(MFlowStepParamsMouse *params){
QString lastStepID = params->stepID;
if(params->carryParent!=nullptr){
MFlowStepParamsLoop * ploop = static_cast<MFlowStepParamsLoop *>(params->carryParent);
if(params->carryStepLocation==MFlowStepParams::LocationType::Last){
// 移动鼠标不能作为单元素循环的最后一步
if(ploop->loopTypeName==MCONSTANT_RADIO_SITEADDRESS){
if(ploop->carryAddressCurrent<ploop->carryAddressTotal){
ploop->carryAddressCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}else {
emit mWebViewManager->cleanWebViews(ploop->carryCurrentWebView);
if(ploop->carryCurrent<ploop->carryTotal){
ploop->carryCurrent+=1;
lastStepID = ploop->stepID;
}else {
this->startLoopTail(ploop->stepID,params->stepID);
return ;
}
}
}
}
startNextStep(lastStepID);
}
void RunDialog::sendStartJobCommand(){
loadingLabel->show();
mFields = mHelper->fields;// 用任务中的字段代替数据表的字段,并重新赋header
tableWidget->setColumnCount(mFields.length());
tableWidget->setHorizontalHeaderLabels(mFields);
// 任务已经开始,可以做一些业务逻辑
//TODO
exportBtn->hide();
startBtn->hide();
stopBtn->show();
stopBtn->setEnabled(true);
tableWidget->setRowCount(0);
tableWidget->clearContents();
mThreadPipline->sendStartCommand(mTask->runParams.loopPeriod);
updatePageData(0,false);
QString lastStepID = NULL;//NULL开始的为从头开始执行
startNextStep(lastStepID);
}
void RunDialog::sendStopJobCommand(RunMessage::MessageType messageType,const QString &msg){
mThreadPipline->sendStopCommand();
stopBtn->setEnabled(false);
stopBtn->setText("停止中");
mSendStopMessageType = messageType;
mSendStopMsg = msg;
}
void RunDialog::onThreadPiplineJobFinished(){
// 任务已经确认被停止,可以做一些业务逻辑
//TODO
exportBtn->show();
startBtn->show();
stopBtn->hide();
stopBtn->setText("停止采集");
loadingLabel->hide();
if(mTask->runParams.isLoop){
if(mTask->runParams.loopIsContinue){
int duration = 1000 * 60 *mTask->runParams.loopInterval;
QTimer::singleShot(duration,this,[this](){
++mTask->runParams.loopPeriod;
this->sendStartJobCommand();
});
}else{
mMessage->showMessage(mSendStopMessageType,mSendStopMsg);
}
}else{
mMessage->showMessage(mSendStopMessageType,mSendStopMsg);
}
// QTimer *timer = new QTimer(this);
// connect(timer,&QTimer::timeout,this,[=](){
// if(mThreadPipline->jobFinished){
// timer->stop();
// timer->disconnect();
// timer->deleteLater();
// }
// });
// timer->start(100);
}
void RunDialog::onThreadPiplineAlert(int type,QString info){
if(1==type){
bottomLogLabel->setText(info);
info.clear();
}else if (11==type) {
sendStopJobCommand(RunMessage::MessageType::ERROR,info);
}else{
sendStopJobCommand(RunMessage::MessageType::SUCCESS,info);
}
}
void RunDialog::onThreadPiplineUpdateData(int num,QStringList names,QStringList values){
updatePageData(num,true);
if(num%PAGESIZE==0){
tableWidget->setRowCount(0);
tableWidget->clearContents();
}
int row = tableWidget->rowCount();
tableWidget->insertRow(row);
tableWidget->setRowHeight(row,30);
for (int i = 0; i < names.length(); ++i) {
int column = mHelper->fieldsH[names[i]];
tableWidget->setItem(row,column,new QTableWidgetItem(values[i]));
}
tableWidget->scrollToBottom();
names.clear();
values.clear();
}
void RunDialog::onCleanWebViews(RunWebEngineView *webView){
addrLine->setText(webView->url().url());
int wl = webViewStacked->count();
if(wl < 5){ // stacked中的webView小于5个则判断是否存在
bool isExist = false;
for (int i=0;i<wl;++i) {
if(webViewStacked->widget(i)==webView){
isExist = true;
break;
}
}
if(!isExist){
webViewStacked->addWidget(webView);
}
}else{
for (int i=0;i<wl;++i) {
webViewStacked->removeWidget(webViewStacked->widget(i));
}
webViewStacked->addWidget(webView);
}
webViewStacked->setCurrentWidget(webView);
}
void RunDialog::onWebViewUrlChanged(const QString &url){
addrLine->setText(url);
}
void RunDialog::initTopMenuUi(){
QWidget *menuWidget = new QWidget(this);
menuWidget->setFixedHeight(40);
QHBoxLayout *menuHLayout = new QHBoxLayout(menuWidget);
menuHLayout->setContentsMargins(10,0,10,0);
menuHLayout->setSpacing(0);
addrLine = new QLineEdit(menuWidget);
addrLine->setStyleSheet(m_stylesheet_QLineEdit);
addrLine->setClearButtonEnabled(true);
addrLine->setFocusPolicy(Qt::FocusPolicy::ClickFocus);
addrLine->setFixedHeight(28);
loadingLabel = new ComLoadingLabel(menuWidget);
QPushButton *refreshBtn = new QPushButton(menuWidget);
refreshBtn->setStyleSheet(m_stylesheet_QPushButton_hollow);
refreshBtn->setFixedSize(70,25);
refreshBtn->setCursor(Qt::PointingHandCursor);
refreshBtn->setText("刷新");
connect(refreshBtn,&QPushButton::clicked,this,[this](){
if(mThreadPipline->jobFinished){
mWebViewManager->getCurrentWebView()->load(QUrl(addrLine->text().trimmed()));
}else{
ComMessageBox::error(this,"任务执行中,无法刷新");
}
});
menuHLayout->addWidget(addrLine);
menuHLayout->addSpacing(10);
menuHLayout->addWidget(loadingLabel);
menuHLayout->addSpacing(10);
menuHLayout->addWidget(refreshBtn);
menuHLayout->addSpacing(10);
boxLayout->addWidget(menuWidget);
}
void RunDialog::initWebViewUi(){
webViewStacked = new QStackedWidget(this);
webViewStacked->setContentsMargins(0,0,0,0);
boxLayout->addWidget(new ComLineWidget(this));
boxLayout->addWidget(webViewStacked);
// webViewStacked
// QWidget *webViewWidget = new QWidget(this);
// QVBoxLayout *webViewLayout = new QVBoxLayout(webViewWidget);
// webViewLayout->setContentsMargins(0,0,0,0);
// webViewLayout->setSpacing(0);
// webViewStacked = new QStackedWidget(webViewWidget);
// webViewLayout->addWidget(webViewStacked);
// boxLayout->addWidget(new ComLineWidget(this));
// boxLayout->addWidget(webViewWidget);
}
void RunDialog::updatePageData(int num,bool isShowLastPage){
if(num==0){// num == 0 恢复为默认参数
mCurPage = 1;
}
int totalPage = num / PAGESIZE; // 总页数
if((num % PAGESIZE) > 0){
totalPage +=1;
}
mTotalPage = totalPage;
if(isShowLastPage){// 是否显示最后的数据对应的页面
mCurPage = mTotalPage;
}
pageLabel->setText(QString::number(mCurPage));
pageLogLabel->setText(QString("共计%1条,%2页").arg(num).arg(mTotalPage));
}
void RunDialog::getData(int p){
mCurPage = p;
tableWidget->setRowCount(0);
tableWidget->clearContents();
QTimer::singleShot(100,this,[this](){
updatePageData(Database::getInstance()->getTableRowCount(mTask->code),false);//更新page
int fieldCount = mFields.length();
QString sql = QString("select %1 from %2 limit %3,%4 ").arg(mFields.join(",")).arg(mTask->code).arg(PAGESIZE * (mCurPage-1)).arg(PAGESIZE);
QVector<QVector<QString>> data = Database::getInstance()->select(fieldCount,sql);
tableWidget->setRowCount(data.size());
for (int row = 0; row < data.size(); ++row) {
tableWidget->setRowHeight(row,30);
for (int column = 0; column < fieldCount; ++column) {
QTableWidgetItem *item = new QTableWidgetItem(data[row][column]);
tableWidget->setItem(row,column,item);
}
}
tableWidget->scrollToBottom();
});
}
void RunDialog::initBottomUi(){
// 状态
QWidget *stateWidget = new QWidget(this);
stateWidget->setFixedHeight(30);
QHBoxLayout *stateHLayout = new QHBoxLayout(stateWidget);
stateHLayout->setContentsMargins(0,0,0,0);
tableStateBtn = new QToolButton(stateWidget);
tableStateBtn->setCursor(Qt::PointingHandCursor);
tableStateBtn->setFixedSize(20,20);
tableStateBtn->setAutoRaise(true);
tableStateBtn->setArrowType(Qt::ArrowType::RightArrow);
QLabel *stateLabel = new QLabel(stateWidget);
stateLabel->setStyleSheet(m_stylesheet_QLabel12);
stateLabel->setText("箭头向下可查看数据");
stateHLayout->addStretch(10);
stateHLayout->addWidget(tableStateBtn);
stateHLayout->addSpacing(6);
stateHLayout->addWidget(stateLabel);
stateHLayout->addStretch(10);
tableWidget = new QTableWidget(this);
tableWidget->setFixedHeight(300);
tableWidget->setFrameShape(QFrame::NoFrame);//设置无边框
tableWidget->setFocusPolicy(Qt::NoFocus); //去除虚边框
tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);//选中一行(整行选中)
tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//设置编辑方式:禁止编辑表格
tableWidget->verticalHeader()->setVisible(true);
tableWidget->horizontalHeader()->setVisible(true);
tableWidget->hide();
connect(tableStateBtn,&QToolButton::clicked,this,[this](){
if(tableStateBtn->arrowType()==Qt::ArrowType::DownArrow){
tableWidget->hide();
tableStateBtn->setArrowType(Qt::ArrowType::RightArrow);
}else if (tableStateBtn->arrowType()==Qt::ArrowType::RightArrow) {
tableWidget->show();
tableStateBtn->setArrowType(Qt::ArrowType::DownArrow);
}
});
// 翻页行
QWidget *turnWidget = new QWidget(this);
turnWidget->setFixedHeight(30);
QHBoxLayout *turnHLayout = new QHBoxLayout(turnWidget);
turnHLayout->setContentsMargins(0,0,0,0);
turnHLayout->setSpacing(6);
QToolButton *last = new QToolButton(this);
last->setText("<");
QToolButton *next = new QToolButton(this);
next->setText(">");
pageLabel = new QLabel(this);
pageLabel->setStyleSheet(m_stylesheet_QLabel12);
pageLogLabel = new QLabel(this);
pageLogLabel->setStyleSheet(m_stylesheet_QLabel12);
updatePageData(0,false);
turnHLayout->addStretch(10);
turnHLayout->addWidget(last);
turnHLayout->addWidget(pageLabel);
turnHLayout->addWidget(next);
turnHLayout->addWidget(pageLogLabel);
turnHLayout->addStretch(10);
connect(last,&QToolButton::clicked,this,[this](){
if(mCurPage>1){
getData(mCurPage-1);
}
});
connect(next,&QToolButton::clicked,this,[this](){
if(mCurPage<mTotalPage){
getData(mCurPage+1);
}
});
// 底部菜单行
QWidget *bottomMenuWidget = new QWidget(this);
bottomMenuWidget->setFixedHeight(40);
QHBoxLayout *bottomMenuHLayout = new QHBoxLayout(bottomMenuWidget);
bottomMenuHLayout->setContentsMargins(10,0,10,0);
bottomMenuHLayout->setSpacing(0);
bottomLogLabel = new QLabel(bottomMenuWidget);
exportBtn = new QPushButton(bottomMenuWidget);
exportBtn->setStyleSheet(m_stylesheet_QPushButton_hollow);
exportBtn->setFixedSize(70,28);
exportBtn->setCursor(Qt::PointingHandCursor);
exportBtn->setText(tr("导出数据"));
startBtn = new QPushButton(bottomMenuWidget);
startBtn->setStyleSheet(m_stylesheet_QPushButton);
startBtn->setCursor(Qt::PointingHandCursor);
if(!mTask->runParams.isLoop){
startBtn->setFixedSize(70,28);
startBtn->setText(tr("开始采集"));
}else{
startBtn->setFixedSize(120,28);
startBtn->setText(tr("定时启动中"));
}
stopBtn = new QPushButton(bottomMenuWidget);
stopBtn->setStyleSheet(m_stylesheet_QPushButton);
stopBtn->setFixedSize(70,28);
stopBtn->setCursor(Qt::PointingHandCursor);
stopBtn->setText(tr("停止采集"));
exportBtn->hide();
startBtn->hide();
stopBtn->hide();
if(!mTask->runParams.isLoop){
connect(startBtn,&QPushButton::clicked,this,[this](){
sendStartJobCommand();
});
}
connect(exportBtn,&QPushButton::clicked,this,[this](){
TaskDataExportDialog *dlg = new TaskDataExportDialog(this,mTask->name,mTask->code);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
});
connect(stopBtn ,&QPushButton::clicked,this,[this](){
if(mTask->runParams.isLoop){
mTask->runParams.loopIsContinue = false;
sendStopJobCommand(RunMessage::MessageType::WARNING,"(循环采集被主动终止)中止采集");
}else{
sendStopJobCommand(RunMessage::MessageType::WARNING,"中止采集");
}
});
bottomMenuHLayout->addWidget(bottomLogLabel);
bottomMenuHLayout->addStretch(10);
bottomMenuHLayout->addWidget(exportBtn);
bottomMenuHLayout->addSpacing(10);
bottomMenuHLayout->addWidget(startBtn);
bottomMenuHLayout->addSpacing(10);
bottomMenuHLayout->addWidget(stopBtn);
boxLayout->addWidget(new ComLineWidget(this));
boxLayout->addWidget(stateWidget);
boxLayout->addWidget(new ComLineWidget(this));
boxLayout->addWidget(tableWidget);
boxLayout->addWidget(turnWidget);
boxLayout->addWidget(new ComLineWidget(this));
boxLayout->addWidget(bottomMenuWidget);
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

一个Qt开发的可以替代爬虫的网页数据采集软件,它最重要的特点就是,降低了采集网页数据的门槛,由至少必须掌握一门编程语言降低到只要会操作电脑即可。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/coderanks/DS.git
git@gitee.com:coderanks/DS.git
coderanks
DS
DS
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /