Эх сурвалжийг харах

V0.3
1、页面基本完成了

Apple 3 сар өмнө
parent
commit
362339ca46
57 өөрчлөгдсөн 2084 нэмэгдсэн , 106 устгасан
  1. 1 1
      External
  2. 15 0
      SwitchOnOff.sql
  3. 9 4
      TransmitterSwitch/AddItem/addspecialitem.cpp
  4. 1 1
      TransmitterSwitch/AddItem/addspecialitem.ui
  5. 55 0
      TransmitterSwitch/ItemData/ItemData.cpp
  6. 7 0
      TransmitterSwitch/ItemData/ItemData.h
  7. 21 6
      TransmitterSwitch/ItemData/oneitem.cpp
  8. 4 0
      TransmitterSwitch/ItemData/oneitem.h
  9. 29 10
      TransmitterSwitch/Resource/QSS/AddSpecialItem_Light.qss
  10. 9 0
      TransmitterSwitch/Resource/QSS/OneItem_dark.qss
  11. 7 0
      TransmitterSwitch/Resource/QSS/TransmitterSwitch_dark.qss
  12. 1 0
      TransmitterSwitch/Resource/TransSwitch.qrc
  13. 129 0
      TransmitterSwitch/Template/importtemplate.cpp
  14. 35 0
      TransmitterSwitch/Template/importtemplate.h
  15. 281 0
      TransmitterSwitch/Template/importtemplate.ui
  16. 117 0
      TransmitterSwitch/Template/savetotemplate.cpp
  17. 36 0
      TransmitterSwitch/Template/savetotemplate.h
  18. 264 0
      TransmitterSwitch/Template/savetotemplate.ui
  19. 4 2
      TransmitterSwitch/TransmitterSwitchInfo.h
  20. 70 33
      TransmitterSwitch/WebAPI/FromWebAPI.cpp
  21. 2 0
      TransmitterSwitch/WebAPI/FromWebAPI.h
  22. 3 0
      TransmitterSwitch/common/StyleManager/lhstylemanager.h
  23. 0 6
      TransmitterSwitch/common/date/CalendarHeader.qss
  24. 1 1
      TransmitterSwitch/common/date/calendarnav.cpp
  25. 8 0
      TransmitterSwitch/common/date/calendarwidgetex.cpp
  26. 18 0
      TransmitterSwitch/common/date/calendarwidgetex.h
  27. 20 1
      TransmitterSwitch/common/date/cdate.cpp
  28. 8 0
      TransmitterSwitch/common/date/cdate.h
  29. BIN
      TransmitterSwitch/common/date/icon/dark/nextMonth.png
  30. BIN
      TransmitterSwitch/common/date/icon/dark/nextMonth_hover.png
  31. BIN
      TransmitterSwitch/common/date/icon/dark/nextYear.png
  32. BIN
      TransmitterSwitch/common/date/icon/dark/nextYear_hover.png
  33. BIN
      TransmitterSwitch/common/date/icon/dark/preMonth.png
  34. BIN
      TransmitterSwitch/common/date/icon/dark/preMonth_hover.png
  35. BIN
      TransmitterSwitch/common/date/icon/dark/preYear.png
  36. BIN
      TransmitterSwitch/common/date/icon/dark/preYear_hover.png
  37. 0 0
      TransmitterSwitch/common/date/icon/light/nextMonth.png
  38. 0 0
      TransmitterSwitch/common/date/icon/light/nextMonth_hover.png
  39. 0 0
      TransmitterSwitch/common/date/icon/light/nextYear.png
  40. 0 0
      TransmitterSwitch/common/date/icon/light/nextYear_hover.png
  41. 0 0
      TransmitterSwitch/common/date/icon/light/preMonth.png
  42. 0 0
      TransmitterSwitch/common/date/icon/light/preMonth_hover.png
  43. 0 0
      TransmitterSwitch/common/date/icon/light/preYear.png
  44. 0 0
      TransmitterSwitch/common/date/icon/light/preYear_hover.png
  45. 56 0
      TransmitterSwitch/common/date/qss/CalendarNav_dark.qss
  46. 8 8
      TransmitterSwitch/common/date/qss/CalendarNav_light.qss
  47. 18 9
      TransmitterSwitch/common/date/rescalendar.qrc
  48. 205 0
      TransmitterSwitch/common/warning/warning copy.ui_
  49. 112 0
      TransmitterSwitch/common/warning/warning.cpp
  50. 46 0
      TransmitterSwitch/common/warning/warning.h
  51. 222 0
      TransmitterSwitch/common/warning/warning.ui
  52. 150 17
      TransmitterSwitch/transmitterswitch.cpp
  53. 11 4
      TransmitterSwitch/transmitterswitch.h
  54. 4 0
      show1/CMakeLists.txt
  55. 29 3
      show1/widget.cpp
  56. 6 0
      show1/widget.h
  57. 62 0
      show1/widget.ui

+ 1 - 1
External

@@ -1 +1 @@
-Subproject commit 065b3651fa3bc23f4540ed042d29912cb105526b
+Subproject commit a4a44be90a55808230099f7d91058c41d1a22dfe

+ 15 - 0
SwitchOnOff.sql

@@ -0,0 +1,15 @@
+
+#查询发射机计划
+SELECT *
+FROM tExecPlan;
+
+
+#删除发射机计划
+DELETE 
+FROM tExecPlan
+WHERE PTTypeCode = 955;
+
+DELETE 
+FROM tExecPlan
+WHERE PTTypeCode = :PTTypeCode;
+

+ 9 - 4
TransmitterSwitch/AddItem/addspecialitem.cpp

@@ -52,6 +52,8 @@ AddSpecialItem::AddSpecialItem(QWidget *parent) :
     /* 设置默认时间 */
     m_time.setHMS(0, 0, 0);
     m_date = QDate::currentDate();
+    ui->dateEdit->setDate(m_date);
+    ui->dateEdit->setDisplayFormat("yyyy-MM-dd");
 
     /* 连接信号和槽 */
     connect(ui->pBtn_Close, &QPushButton::clicked, this, &QDialog::close);
@@ -65,6 +67,7 @@ AddSpecialItem::AddSpecialItem(QWidget *parent) :
     connect(ui->comBox_actionSelect,QOverload<const QString&>::of(&QComboBox::currentTextChanged),this, &AddSpecialItem::do_selectAction);
     /* 打开时间选择器 */
     connect(ui->pBtn_selectTime, &QPushButton::clicked, this, &AddSpecialItem::do_selectTime);
+    connect(ui->pBtn_iconTime, &QPushButton::clicked, this, &AddSpecialItem::do_selectTime);
     
     /* 设置事件过滤器 */
     ui->comBox_actionSelect->installEventFilter(this);
@@ -102,7 +105,7 @@ void AddSpecialItem::setDevice(QMap<QString, DeviceInfo>& mapDev)
 /* 设置周几 */
 void AddSpecialItem::setWeekDay(int week)
 {
-    if(week < 0 || week > 6)
+    if(week != 7)
     {
         return;
     }
@@ -135,6 +138,9 @@ void AddSpecialItem::do_ok()
         ui->label_actionWarn->show();
         setComboBoxWarning(ui->comBox_actionSelect, true);
     }
+
+    /* 赋值日期 */
+    m_date = ui->dateEdit->date();
     
     /* 检查时间是否为空 */
     if(m_time.isNull())
@@ -145,8 +151,7 @@ void AddSpecialItem::do_ok()
         return;
     }
     /* 进行设备查重 */
-    // bool ret = m_p->judgeTimeRepetition(*m_p->m_vecItem[m_p->m_stack->currentIndex()],m_devName,m_time);
-    bool ret = IData.judgeTimeRepetitionWithAdd(m_week, m_devName, m_time);
+    bool ret = IData.judgeDateTimeRepetitionWithAdd(m_week, m_devName, m_date, m_time);
     if(ret)
     {
         ui->label_timeWarn->setText("一个时间点,单个设备仅能执行一个操作!");
@@ -156,7 +161,7 @@ void AddSpecialItem::do_ok()
     }
     m_isAddDev = true;
     /* 添加一项计划 */
-    LH_WRITE_LOG_DEBUG(QString("添加一项计划: 设备:%1, 动作:%2, 时间:%3").arg(m_devName).arg(m_action).arg(m_time.toString("hh:mm:ss")));
+    LH_WRITE_LOG_DEBUG(QString("添加一项计划: 设备:%1, 动作:%2, 日期:%3, 时间:%4").arg(m_devName).arg(m_action).arg(m_date.toString("yyyy-MM-dd")).arg(m_time.toString("hh:mm:ss")));
 
     /* 发送信号 */
     emit signal_AddSpecialItem(m_devName, m_action, m_date, m_time);

+ 1 - 1
TransmitterSwitch/AddItem/addspecialitem.ui

@@ -223,7 +223,7 @@
         <widget class="CustomComboBox" name="comBox_actionSelect">
          <property name="geometry">
           <rect>
-           <x>108</x>
+           <x>110</x>
            <y>257</y>
            <width>274</width>
            <height>32</height>

+ 55 - 0
TransmitterSwitch/ItemData/ItemData.cpp

@@ -1,4 +1,6 @@
 #include "ItemData/ItemData.h"
+#include "LHQLogAPI.h"
+
 
 ItemData::ItemData()
 {
@@ -58,6 +60,34 @@ void ItemData::deleteOneItem(int week, int num)
 
 }
 
+/* 清空一天的计划 */
+void ItemData::clearOneDay(int week)
+{
+    if(m_mapItem.find(week) == m_mapItem.end())
+    {
+        return;
+    }
+    auto list = m_mapItem[week];
+    for(auto it = list->begin(); it != list->end(); ++it)
+    {
+        delete *it;
+    }
+    list->clear();
+}
+
+/* 清空所有的计划数据 */
+void ItemData::clearAllItem()
+{
+    for(auto it = m_mapItem.begin(); it != m_mapItem.end(); ++it)
+    {
+        for(auto it1 = it.value()->begin(); it1 != it.value()->end(); ++it1)
+        {
+            delete *it1;
+        }
+        it.value()->clear();
+    }
+}
+
 
 /* 查找有没有这个项 */
 bool ItemData::findItem(OneItem* item)
@@ -129,6 +159,31 @@ bool ItemData::judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, c
 }
 
 
+bool ItemData::judgeDateTimeRepetitionWithAdd(int weekDay, const QString& devName, const QDate& date, const QTime& time)
+{
+    /* 先查找周几对应的列表 */
+    if(m_mapItem.find(weekDay) == m_mapItem.end())
+    {
+        return false;
+    }
+    auto list = m_mapItem[weekDay];
+    for(const auto& it : *list)
+    {
+        if(it->getDevName() == devName)
+        {
+            if(it->getDate() == date)
+            {
+                if(it->getExecTime() == time)
+                {
+                    return true;
+                }
+            }
+        }
+    }
+    /* 所有设备都判断完了,没有相同的 */
+    return false;
+}
+
 /* 判断已有的项修改时间后和其他项是否重复 */
 bool ItemData::judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime)
 {

+ 7 - 0
TransmitterSwitch/ItemData/ItemData.h

@@ -29,14 +29,21 @@ public:
     void addOneItem(int week, OneItem* item);
     /* 删除一项计划 */
     void deleteOneItem(int week, int num);
+    /* 清空一天的计划 */
+    void clearOneDay(int week);
+    /* 清空所有的计划数据 */
+    void clearAllItem();
     /* 查找有没有这个项 */
     bool findItem(OneItem* item);
     bool findItem(int week, OneItem* item);
+    /* 获取整个容器 */
+    QMap<int, QList<OneItem*>*>& getMapItem() { return m_mapItem; }
     /* 获取一天的容器 */
     QList<OneItem*>* getOneDay(int week);
 
     /* 新增判断是否有重复 */
     bool judgeTimeRepetitionWithAdd(int weekDay, const QString& devName, const QTime& time);
+    bool judgeDateTimeRepetitionWithAdd(int weekDay, const QString& devName, const QDate& date, const QTime& time);
     /* 判断已有的项修改时间后和其他项是否重复 */
     bool judgeTimeRepetitionWithEdit(int weekDay, OneItem* item, const QTime& newTime);
     /* 判断特殊日的已有项修改时间后和其他项是否重复 */

+ 21 - 6
TransmitterSwitch/ItemData/oneitem.cpp

@@ -13,6 +13,27 @@ OneItem::OneItem(QWidget *parent, bool isSpecial) :
 {
     ui->setupUi(this);
 
+    init();
+}
+
+OneItem::OneItem(bool isSpecial) : 
+    QWidget(nullptr), m_isSpecial(isSpecial),
+    ui(new Ui::OneItem)
+{
+    ui->setupUi(this);
+
+    init();
+}
+
+OneItem::~OneItem()
+{
+    delete ui;
+}
+
+
+/* 初始化 */
+void OneItem::init()
+{
     /* 加载QSS */
     QFile file(":/QSS/QSS/OneItem_dark.qss");
     if(file.open(QIODevice::ReadOnly))
@@ -61,12 +82,6 @@ OneItem::OneItem(QWidget *parent, bool isSpecial) :
     connect(ui->pBtn_close, &QPushButton::clicked, this, &OneItem::do_pBtn_close_clicked);
 }
 
-OneItem::~OneItem()
-{
-    delete ui;
-}
-
-
 /* 设置序号 */
 void OneItem::setNum(int num)
 {

+ 4 - 0
TransmitterSwitch/ItemData/oneitem.h

@@ -17,8 +17,12 @@ class OneItem : public QWidget
 
 public:
     explicit OneItem(QWidget *parent = nullptr, bool isSpecial = false);
+    explicit OneItem(bool isSpecial = false);
     ~OneItem();
 
+    /* 初始化 */
+    void init();
+
     /* 获取UUID */
     QUuid getUUID() { return m_uuid; }
     /* 设置周几 */

+ 29 - 10
TransmitterSwitch/Resource/QSS/AddSpecialItem_Light.qss

@@ -200,10 +200,10 @@ QComboBox QScrollBar::sub-line::vertical{/*下箭头*/
 
 
 /* ==========================================================
- *  时间报警红框
+ *  时间选择器
  * ========================================================== */
 
-QLabel#label_iconTime
+QPushButton#pBtn_iconTime
 {
 	border-image: url(:/ICON/ICON/Time.png);
 }
@@ -262,21 +262,40 @@ QPushButton#pBtn_selectTime[Warn=true]
     border: 1px solid #D21F21;
 }
 
-TimeWidget
+QPushButton#btn_tip
+{
+    border-image: url(:/ICON/ICON/Time.png);
+}
+
+/* ==========================================================
+ *  日期选择器
+ * ========================================================== */
+
+CalendarDTEdit
 {
-    /* background: transparent; */
+	background: #FFFFFF;
     border-radius: 4px;
     padding-left:12px;
-    border: 1px solid #4458FE;
+    border: 1px solid #E6E9F4;
 }
 
-/* TimeWidget QPushButton
+CalendarDTEdit[Warn=true]
 {
-    border-image: url(:/ICON/ICON/Time.png);
-} */
+	background: #FFFFFF;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #D21F21;
+}
 
-QPushButton#btn_tip
+CalendarDTEdit:!enabled/* 或者disable */
 {
-    border-image: url(:/ICON/ICON/Time.png);
+    background: rgba(0,0,0,0.04);
+    border: 1px solid #E6E9F4;
 }
 
+CalendarDTEdit::drop-down
+{
+ 	padding-right:8px;
+	width: 16px;
+    image: url(:/ICON/ICON/date_light.png);
+}

+ 9 - 0
TransmitterSwitch/Resource/QSS/OneItem_dark.qss

@@ -86,6 +86,15 @@ QPushButton#pBtn_iconTime
     qproperty-iconSize: 16px 16px;
 }
 
+/* 日期图标 */ 
+QPushButton#pBtn_iconDate
+{
+    background: transparent;
+    border: none;
+    qproperty-icon: url(:/ICON/ICON/date_dark.png);
+    qproperty-iconSize: 16px 16px;
+}
+
 
 /*=====================================================================
  * QComboBox下拉框

+ 7 - 0
TransmitterSwitch/Resource/QSS/TransmitterSwitch_dark.qss

@@ -233,3 +233,10 @@ TimeWidget
     border: 1px solid #438EFF;
 }
 
+CDate
+{
+	background: #FFFFFF;
+    border-radius: 4px;
+    padding-left:12px;
+    border: 1px solid #E6E9F4;
+}

+ 1 - 0
TransmitterSwitch/Resource/TransSwitch.qrc

@@ -2,6 +2,7 @@
     <qresource prefix="/QSS">
         <file>QSS/TransmitterSwitch_dark.qss</file>
         <file>QSS/AddNormalItem_Light.qss</file>
+        <file>QSS/AddSpecialItem_Light.qss</file>
         <file>QSS/OneItem_dark.qss</file>
     </qresource>
     <qresource prefix="/ICON">

+ 129 - 0
TransmitterSwitch/Template/importtemplate.cpp

@@ -0,0 +1,129 @@
+#include "importtemplate.h"
+#include "ui_importtemplate.h"
+
+#include <QDebug>
+#include <QPoint>
+#include <QTableWidgetItem>
+
+#include "common/warning/warning.h"
+
+ImportTemplate::ImportTemplate(QStringList& tabList,QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::ImportTemplate)
+{
+    ui->setupUi(this);
+
+    /* 设置隐藏边框 */
+    this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
+    /* 设置底层样式表 */
+    this->setAttribute(Qt::WA_TranslucentBackground);
+
+    m_templateName.clear();
+
+    /* 设置列数,列宽、列高、不可编辑、选择一行 */
+    ui->tableWidget->setColumnCount(3);
+    ui->tableWidget->setColumnWidth(0,22);
+    ui->tableWidget->setColumnWidth(1,256);
+    ui->tableWidget->setColumnWidth(2,76);
+    ui->tableWidget->verticalHeader()->setDefaultSectionSize(48);           //设置行高
+    ui->tableWidget->setEditTriggers(QTableWidget::NoEditTriggers);         //设置不可编辑
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);   //设置选中一行
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);  //设置只能选中一行
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);    //隐藏竖滚动条
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);  //隐藏横滚动条
+    ui->tableWidget->setShowGrid(false);                                    //隐藏网格线
+    ui->tableWidget->verticalHeader()->setVisible(false);                   //隐藏行号
+    ui->tableWidget->horizontalHeader()->setVisible(false);                 //隐藏列表头
+    ui->tableWidget->setFocusPolicy(Qt::NoFocus);                           //设置不显示选中后的虚线
+//    ui->tableWidget->setSortingEnabled(true);                               //开启排序功能
+    /* 设置行选中后的样式 */
+    ui->tableWidget->setStyleSheet(R"(
+        QTableWidget::item:selected{
+            background: rgba(231,236,255,0.5);
+        })");
+
+    ui->label_warning->hide();
+
+    connect(ui->pBtn_close,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_cancel,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_ok,SIGNAL(clicked()),this,SLOT(do_ok()));
+    connect(ui->tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(do_seletctRow(int,int)));
+
+
+    /* 先设置表格的列数 */
+    ui->tableWidget->setRowCount(tabList.count());
+    for(int i = 0;i < tabList.count();i++)
+    {
+        createRow(i,i+1,tabList.at(i));
+    }
+
+}
+
+ImportTemplate::~ImportTemplate()
+{
+    delete ui;
+}
+
+void ImportTemplate::do_ok()
+{
+    ui->label_warning->hide();
+    if(m_templateName.isEmpty())
+    {
+        ui->label_warning->setText("请选择模版");
+        ui->label_warning->show();
+        return;
+    }
+    emit signal_templateName(m_templateName);
+    this->close();
+}
+/* 选中一行 */
+void ImportTemplate::do_seletctRow(int row, int col)
+{
+    if(col == 2)
+    {
+        /* 弹出框提示确定要删除 */
+        Warning w(this);
+        w.setText("是否删除模板?");
+        bool flag = false;
+        connect(&w,&Warning::signal_ok,this,[&](){
+            flag = true;
+        });
+//        std::shared_ptr<LHMaskWidget> mask = std::make_shared<LHMaskWidget>();
+//        mask->SetMainWidget(this);       /* 设置主窗口(被遮盖的窗口) */
+//        mask->SetTrigWidget(&w);           /* 设置触发的窗口 */
+//        mask->SetOpacity(float(0.4));
+        w.exec();
+        if(!flag)
+        {
+            return;
+        }
+        emit signal_deleteTemplate(ui->tableWidget->item(row,1)->text());
+        ui->tableWidget->removeRow(row);
+        /* 对模版重新编号 */
+        for(int i = 0 ;i < ui->tableWidget->rowCount();i++)
+        {
+            ui->tableWidget->item(i,0)->setData(Qt::DisplayRole,i+1);
+        }
+    }else
+    {
+        m_templateName = ui->tableWidget->item(row,1)->text();
+    }
+}
+
+/* 创建一行数据 */
+void ImportTemplate::createRow(int row,int num,const QString &text)
+{
+    QTableWidgetItem* item = new QTableWidgetItem;
+    item->setData(Qt::DisplayRole,num);
+    item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+    ui->tableWidget->setItem(row,0,item);
+
+    item = new QTableWidgetItem(text);
+    item->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft);
+    ui->tableWidget->setItem(row,1,item);
+
+    item = new QTableWidgetItem("删除");
+    item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+    item->setForeground(Qt::blue);
+    ui->tableWidget->setItem(row,2,item);
+}

+ 35 - 0
TransmitterSwitch/Template/importtemplate.h

@@ -0,0 +1,35 @@
+#ifndef IMPORTTEMPLATE_H
+#define IMPORTTEMPLATE_H
+
+#include <QDialog>
+
+class TemplateItem;
+
+namespace Ui {
+class ImportTemplate;
+}
+
+class ImportTemplate : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ImportTemplate(QStringList& tabList,QWidget *parent = nullptr);
+    ~ImportTemplate();
+
+    void createRow(int row,int num,const QString& text);                    /* 创建一行数据 */
+signals:
+    void signal_templateName(QString name);
+    void signal_deleteTemplate(QString name);                               /* 删除一个模版 */
+
+private slots:
+    void do_ok();
+    void do_seletctRow(int row,int col);                                    /* 选中一行 */
+
+private:
+    Ui::ImportTemplate *ui;
+
+    QString m_templateName;                                                 /* 模版名称 */
+};
+
+#endif // IMPORTTEMPLATE_H

+ 281 - 0
TransmitterSwitch/Template/importtemplate.ui

@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ImportTemplate</class>
+ <widget class="QDialog" name="ImportTemplate">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>444</width>
+    <height>618</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">QDialog#ImportTemplate{
+background:transparent;
+}</string>
+  </property>
+  <widget class="QWidget" name="widget" native="true">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>444</width>
+     <height>618</height>
+    </rect>
+   </property>
+   <property name="styleSheet">
+    <string notr="true">QWidget{
+background: #FFFFFF;
+border-radius: 8px;
+
+font-family: 思源黑体R;
+font-weight: 400;
+font-size: 14px;
+color: #3A3F63;
+line-height: 21px;
+text-align: left;
+font-style: normal;
+}
+QLabel#label_NC1{
+font-weight: bold;
+font-size: 18px;
+color: #3A3F63;
+line-height: 27px;
+text-align: left;
+font-style: normal;
+text-transform: uppercase;
+}
+
+QLabel#label_NC2,QLabel#label_NC3,QLabel#label_NC4
+{
+font-weight: 400;
+font-size: 14px;
+color: #5A607F;
+line-height: 21px;
+text-align: left;
+font-style: normal;
+}
+
+QLabel#label_line1,QLabel#label_line2,QLabel#label_line3
+{
+background: #E6E9F4;
+}
+QLabel#label_warning
+{
+color:red;
+}
+
+QPushButton#pBtn_close{
+	border-image: url(:/ESM-8C_ICON/Dialog_close.png);
+}
+
+QPushButton#pBtn_close:hover{
+	
+	border-image: url(:/ESM-8C_ICON/Dialog_close2.png);
+}
+
+
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+}
+
+</string>
+   </property>
+   <widget class="QLabel" name="label_NC1">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>18</y>
+      <width>80</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>导入模板</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_close">
+    <property name="geometry">
+     <rect>
+      <x>396</x>
+      <y>12</y>
+      <width>32</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_line1">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>56</y>
+      <width>444</width>
+      <height>1</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_line2">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>89</y>
+      <width>380</width>
+      <height>1</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_line3">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>137</y>
+      <width>380</width>
+      <height>1</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_NC2">
+    <property name="geometry">
+     <rect>
+      <x>44</x>
+      <y>107</y>
+      <width>32</width>
+      <height>14</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>序号</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_NC3">
+    <property name="geometry">
+     <rect>
+      <x>92</x>
+      <y>107</y>
+      <width>56</width>
+      <height>14</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>模板名称</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_NC4">
+    <property name="geometry">
+     <rect>
+      <x>364</x>
+      <y>107</y>
+      <width>28</width>
+      <height>14</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>操作</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_cancel">
+    <property name="geometry">
+     <rect>
+      <x>276</x>
+      <y>554</y>
+      <width>60</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>取消</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_ok">
+    <property name="geometry">
+     <rect>
+      <x>352</x>
+      <y>554</y>
+      <width>60</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>确定</string>
+    </property>
+   </widget>
+   <widget class="QTableWidget" name="tableWidget">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>140</y>
+      <width>380</width>
+      <height>384</height>
+     </rect>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_warning">
+    <property name="geometry">
+     <rect>
+      <x>50</x>
+      <y>65</y>
+      <width>351</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>TextLabel</string>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 117 - 0
TransmitterSwitch/Template/savetotemplate.cpp

@@ -0,0 +1,117 @@
+#include "savetotemplate.h"
+#include "ui_savetotemplate.h"
+
+#include "BroadCastTime.h"
+#include "ExecPlan.h"
+
+SaveToTemplate::SaveToTemplate(PageType type, QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::SaveToTemplate)
+{
+    ui->setupUi(this);
+
+    /* 设置隐藏边框 */
+    this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
+    /* 设置底层样式表 */
+    this->setAttribute(Qt::WA_TranslucentBackground);
+
+    m_type = type;
+
+    ui->label_warn->hide();
+
+    /* 限制字数类型 */
+    ui->lineEdit->setMaxLength(15);
+
+    connect(ui->pBtn_close,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_cancel,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_ok,SIGNAL(clicked()),this,SLOT(do_ok()));
+}
+
+SaveToTemplate::~SaveToTemplate()
+{
+    delete ui;
+}
+
+void SaveToTemplate::do_ok()
+{
+    ui->label_warn->hide();
+    setWarning(false);
+    /* 检查这一页的项是否为空 */
+    if(m_type == PageType::PageExecPlan)
+    {
+        auto p = qobject_cast<ExecPlan*>(this->parent());
+        if(p->itemIsEmpty())
+        {
+            ui->label_warn->setText("模版内容不能为空!");
+            ui->label_warn->show();
+            setWarning(true);
+            return;
+        }
+    }
+    else if(m_type == PageType::PageBroadCast)
+    {
+        auto p = qobject_cast<BroadCastTime*>(this->parent());
+        if(p->itemIsEmpty())
+        {
+            ui->label_warn->setText("模版内容不能为空!");
+            ui->label_warn->show();
+            setWarning(true);
+            return;
+        }
+    }
+
+
+    /* 检查名称是否是空的 */
+    QString str = ui->lineEdit->text();
+    if(str.isEmpty())
+    {
+        ui->label_warn->setText("请输入模版名称!");
+        ui->label_warn->show();
+        setWarning(true);
+        return;
+    }
+    /* 检查模板名称是否重复 */
+    bool flag = false;
+    if(m_type == PageType::PageBroadCast)
+    {
+        auto p = dynamic_cast<BroadCastTime*>(this->parent());
+        if(p->checkDataBaseTableName(ui->lineEdit->text()))
+        {
+            flag = true;
+        }
+    }
+    else if(m_type == PageType::PageExecPlan)
+    {
+        auto p = dynamic_cast<ExecPlan*>(this->parent());
+        if(p->checkDataBaseTableName(ui->lineEdit->text()))
+        {
+            flag = true;
+        }
+    }
+
+    if(flag)
+    {
+        ui->label_warn->setText("模版名称重复!");
+        ui->label_warn->show();
+        setWarning(true);
+        return;
+    }
+
+    emit signal_templateName(ui->lineEdit->text());
+    this->close();
+}
+
+/* 设置报警 */
+void SaveToTemplate::setWarning(bool flag)
+{
+    if(flag)
+    {
+        ui->lineEdit->setProperty("Warn", true);
+    }else
+    {
+        ui->lineEdit->setProperty("Warn", false);
+    }
+
+    ui->lineEdit->style()->unpolish(ui->lineEdit);
+    ui->lineEdit->style()->polish(ui->lineEdit);
+}

+ 36 - 0
TransmitterSwitch/Template/savetotemplate.h

@@ -0,0 +1,36 @@
+#ifndef SAVETOTEMPLATE_H
+#define SAVETOTEMPLATE_H
+
+#include <QDialog>
+
+#include "common/globalinfo/globalinfo.h"
+
+
+namespace Ui {
+class SaveToTemplate;
+}
+
+
+class SaveToTemplate : public QDialog
+{
+    Q_OBJECT
+
+public:
+
+    explicit SaveToTemplate(PageType type, QWidget *parent = nullptr);
+    ~SaveToTemplate();
+
+signals:
+    void signal_templateName(QString name);
+
+private slots:
+    void do_ok();
+
+private:
+    void setWarning(bool flag);             /* 设置报警 */
+private:
+    Ui::SaveToTemplate *ui;
+    PageType m_type;                        /* 是“播出时段”还是“执行计划” */
+};
+
+#endif // SAVETOTEMPLATE_H

+ 264 - 0
TransmitterSwitch/Template/savetotemplate.ui

@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SaveToTemplate</class>
+ <widget class="QDialog" name="SaveToTemplate">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>416</width>
+    <height>217</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">QDialog#SaveToTemplate{
+background:transparent;
+};</string>
+  </property>
+  <widget class="QWidget" name="widget" native="true">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>416</width>
+     <height>217</height>
+    </rect>
+   </property>
+   <property name="styleSheet">
+    <string notr="true">QWidget{
+background: #FFFFFF;
+border-radius: 8px;
+font-family: 思源黑体R;
+font-weight: 400;
+font-size: 14px;
+color: #3A3F63;
+line-height: 21px;
+text-align: left;
+font-style: normal;
+}
+
+QLabel#label_NC1
+{
+font-family: 思源黑体M;
+font-weight: bold;
+font-size: 18px;
+color: #3A3F63;
+line-height: 27px;
+text-transform: uppercase;
+}
+
+QLabel#label_line
+{
+background: #E6E9F4;
+}
+
+QLabel#label_warn
+{
+	color:red;
+}
+
+QPushButton#pBtn_close{
+	border-image: url(:/ESM-8C_ICON/Dialog_close.png);
+}
+QPushButton#pBtn_close:hover{
+	
+	border-image: url(:/ESM-8C_ICON/Dialog_close2.png);
+}
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+	border-radius: 16px;
+	text-align: center;
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+}
+
+/****************  报警红框  ****************/
+QLineEdit
+{
+    background: #FFFFFF;
+    border-radius: 4px;
+    padding-left:12px;
+	border: 1px solid #E6E9F4;
+}
+
+
+QLineEdit[Warn=true]
+{
+    border: 1px solid #D21F21;
+}
+
+QLineEdit:!enabled/* 或者disable */
+{
+    background: rgba(0,0,0,0.04);
+    border: 1px solid #E6E9F4;
+}
+
+
+</string>
+   </property>
+   <widget class="QLabel" name="label_NC1">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>18</y>
+      <width>110</width>
+      <height>18</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>保存为模版</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_line">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>56</y>
+      <width>416</width>
+      <height>1</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_close">
+    <property name="geometry">
+     <rect>
+      <x>368</x>
+      <y>12</y>
+      <width>32</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_NC3_x">
+    <property name="geometry">
+     <rect>
+      <x>32</x>
+      <y>98</y>
+      <width>7</width>
+      <height>14</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_NC4">
+    <property name="geometry">
+     <rect>
+      <x>40</x>
+      <y>98</y>
+      <width>70</width>
+      <height>14</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>模板名称:</string>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="lineEdit">
+    <property name="geometry">
+     <rect>
+      <x>110</x>
+      <y>89</y>
+      <width>274</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <family>思源黑体R</family>
+      <pointsize>-1</pointsize>
+      <weight>50</weight>
+      <italic>false</italic>
+      <bold>false</bold>
+     </font>
+    </property>
+    <property name="placeholderText">
+     <string>请输入</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_cancel">
+    <property name="geometry">
+     <rect>
+      <x>248</x>
+      <y>153</y>
+      <width>60</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>取消</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="pBtn_ok">
+    <property name="geometry">
+     <rect>
+      <x>324</x>
+      <y>153</y>
+      <width>60</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>保存</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="label_warn">
+    <property name="geometry">
+     <rect>
+      <x>116</x>
+      <y>126</y>
+      <width>261</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 4 - 2
TransmitterSwitch/TransmitterSwitchInfo.h

@@ -40,8 +40,8 @@ enum class enum_Action : int
  */
 struct ExecPlanItemInfo
 {
-    int ExecType;                                   /* 执行类型 */
-    int WeekDay;                                    /* 周几 */
+    int ExecType;                                   /* 执行类型,0按时刻,1按天 */
+    int WeekDay;                                    /* 周几,数据库里是1-7一周,周8是特殊日 */
     QDate date;                                     /* 日期 */
     QTime execTime;                                 /* 执行时间 */
     QString devName;                                /* 设备名称 */
@@ -94,6 +94,8 @@ public:
     void initDevType();
     /* 获取某一个发射机类型 */
     DevTypeInfo getDevType(int PTTypeCode);
+    /* 获取设备类型信息 */
+    QMap<int, DevTypeInfo>& getMapDevType() { return m_mapDevType; }
 
 private:
     QMap<int, DevTypeInfo> m_mapDevType;            /* 设备类型信息,int是发射机的PTTypeCode */

+ 70 - 33
TransmitterSwitch/WebAPI/FromWebAPI.cpp

@@ -3,6 +3,7 @@
 #include <QVector>
 #include <QString>
 #include <QUuid>
+#include <QApplication>
 
 #include "LHQLogAPI.h"
 #include "TransmitterSwitchInfo.h"
@@ -49,7 +50,7 @@ bool FromWebAPI::initWebApi(const QString& url, const QString& serverID, const Q
         LH_WRITE_ERROR(QString("Get server list failed:%1, error info:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
         return false;
     }
-    LH_WRITE_LOG(QString("Get server list success:%1").arg(serverList));
+    LH_WRITE_LOG(QString("\nGet server list success:%1").arg(serverList));
 #endif
 
     /* 登录,第二个参数是限制的服务 */
@@ -167,12 +168,10 @@ bool FromWebAPI::insertData(QList<ExecPlanItemInfo>& list)
         return false;
     }
     /* 先删除表格中的数据 */
-    if(!deleteAllRow())
-    {
-        LH_WRITE_ERROR("删除EQM.tExecPlan表格中的数据失败");
-        return false;
-    }
+    deleteAllTransmitterPlan();
 
+    QDate zeroDate(1970,1,1);
+    /* 写入数据 */
     nJson json0 = nJson::array();
     for(auto& it : list)
     {
@@ -182,23 +181,24 @@ bool FromWebAPI::insertData(QList<ExecPlanItemInfo>& list)
         nJson json2;
         json2["ExecType"] = it.ExecType;
         json2["WeekDay"] = it.WeekDay;
-        json2["Date"] = (it.date.toString("yyyy-MM-dd") == "1970-01-01" ? nullptr : it.date.toString("yyyy-MM-dd").toStdString());
+        json2["Date"] = it.date.toString("yyyy-MM-dd").toStdString();
         json2["ExecTime"] = it.execTime.toString("hh:mm:ss").toStdString();
         json2["DeviceName"] = it.devName.toStdString();
         json2["ActionName"] = it.actionName.toStdString();
         json2["ActionID"] = static_cast<int>(it.actionID);
-        // json2["PTTypeCode"] = it.cfgDev->PTTypeCode < 0 ? 0 : it.cfgDev->PTTypeCode;
-        // if(it.cfgDev == nullptr)
-        // {
-        //     json2["DID"] = 0;
-        //     json2["DTID"] = 0;
-        //     json2["ChannelID"] = 0;
-        // }else 
-        // {
-        //     json2["DID"] = (it.cfgDev->DID < 0 ? 0 : it.cfgDev->DID);
-        //     json2["DTID"] = (it.cfgDev->DTID < 0 ? 0 : it.cfgDev->DTID);
-        //     json2["ChannelID"] = (it.cfgDev->ChannelID < 0 ? 0 : it.cfgDev->ChannelID);
-        // }
+        /* 根据设备名称找到设备信息 */
+        auto devInfo = DeviceContainer.getDevice(it.devName);
+        if(devInfo.PTTypeCode < 0)
+        {
+            LH_WRITE_ERROR(QString("未找到设备:%1").arg(it.devName));
+            continue;
+        }
+        json2["PTTypeCode"] = devInfo.PTTypeCode;
+        json2["DID"] = devInfo.DID;
+        json2["DTID"] = devInfo.DTID;
+        json2["ChannelID"] = devInfo.ChannelID;
+
+
         json1["paramList"] = json2;
 
         json0.push_back(json1);
@@ -206,23 +206,24 @@ bool FromWebAPI::insertData(QList<ExecPlanItemInfo>& list)
 
 
     /* 将json写入本地文件 */
-#ifdef DEBUG
-    QString fileJson(QString::fromStdString(json0.dump()));
-    QString filePath = GlobalInfo.ExecPath() + GlobalInfo.ExecPlanPath + QString("ExecPlanData.json");
-    SPDLOG_LOGGER_DEBUG(m_logger,"To EQM Json写入文件:{}", filePath.toStdString());
-    QFile file(filePath);
-    if(file.open(QIODevice::WriteOnly | QIODevice::Truncate))
-    {
-        file.write(fileJson.toUtf8());
-        file.close();
-    }else {
-        SPDLOG_LOGGER_ERROR(m_logger,"打开文件失败:{}", filePath.toStdString());
-    }
+#ifdef C_DEBUG
+    QString fileJson(QString::fromStdString(json0.dump(4)));
+    LH_WRITE_LOG_DEBUG("\n" + fileJson);
+    // QString filePath = QApplication::applicationDirPath() + QString("ExecPlanData.json");
+    // SPDLOG_LOGGER_DEBUG(m_logger,"To EQM Json写入文件:{}", filePath.toStdString());
+    // QFile file(filePath);
+    // if(file.open(QIODevice::WriteOnly | QIODevice::Truncate))
+    // {
+    //     file.write(fileJson.toUtf8());
+    //     file.close();
+    // }else {
+    //     SPDLOG_LOGGER_ERROR(m_logger,"打开文件失败:{}", filePath.toStdString());
+    // }
 #endif
     /* 写入EQM数据库 */
     QString strCmd = QString::fromStdString(json0.dump());
     QString strRet;
-    auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Insert, strCmd, strRet);
+    auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_BatchTransAction, strCmd, strRet);
     if(ret < 0)
     {
         LH_WRITE_ERROR(QString("写入EQM数据库失败:%1, 错误信息:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
@@ -282,7 +283,7 @@ bool FromWebAPI::getExecPlanData(QList<ExecPlanItemInfo>& list)
             }
 
             info.ExecType = it["execType"].get<int>();
-            info.WeekDay = it["weekDay"].get<int>() - 1;
+            info.WeekDay = it["weekDay"].get<int>();
             auto tmpDate = it["date"].is_null() ? "" : it["date"].get<std::string>();
             if(!tmpDate.empty())
             {
@@ -405,3 +406,39 @@ bool FromWebAPI::deleteAllRow()
     return true;
 }
 
+
+/* 删除所有的发射机计划 */
+bool FromWebAPI::deleteAllTransmitterPlan()
+{
+    if(m_httpApi == nullptr)
+    {
+        LH_WRITE_ERROR("WebAPI is nullptr");
+        return false;
+    }
+    /* 查找出有多少发射机类型 */
+    QList<int> listPttypeCodeID;
+    for(auto& it : DevTypeContainer.getMapDevType())
+    {
+        listPttypeCodeID.append(it.PTTypeCode);
+    }
+    nJson json0;
+    json0["opName"] = "ESM8C_DeleteTransmitterPlan";
+    for(const auto& it : listPttypeCodeID)
+    {
+        json0["paramList"].clear();
+        nJson json1;
+        json1["PTTypeCode"] = it;
+        json0["paramList"].push_back(json1);
+        QString strCmd = QString::fromStdString(json0.dump());
+        QString strRet;
+        auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Delete, strCmd, strRet);
+        if(ret < 0)
+        {
+            LH_WRITE_ERROR(QString("删除发射机(%3)计划失败:%1, 错误信息:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)).arg(it));
+        }else {
+            LH_WRITE_LOG(QString("删除发射机(%1)计划成功!").arg(it));
+        }
+    }
+    return true;
+}
+

+ 2 - 0
TransmitterSwitch/WebAPI/FromWebAPI.h

@@ -27,6 +27,8 @@ public:
     bool getEQMTemplateID(QList<int>& listId);
     /* 删除所有行 */
     bool deleteAllRow();
+    /* 删除所有的发射机计划 */
+    bool deleteAllTransmitterPlan();
 
 private:
 

+ 3 - 0
TransmitterSwitch/common/StyleManager/lhstylemanager.h

@@ -4,6 +4,9 @@
 #include <QList>
 #include <QMutex>
 
+
+#define LHStyleMgr LHStyleManager::Instance()
+
 enum SkinStyle{eBrightStyle, eDarkStyle};
 
 class LHStyleManager : public QObject

+ 0 - 6
TransmitterSwitch/common/date/CalendarHeader.qss

@@ -1,6 +0,0 @@
-QLabel 
-{
-	font-size: 14px;
-	font-weight: 500;
-	color: #3A3F63;
-}

+ 1 - 1
TransmitterSwitch/common/date/calendarnav.cpp

@@ -15,7 +15,7 @@ CalendarNav::CalendarNav(QCalendarWidget *pCalendar, QWidget *parent)
     ui->setupUi(this);
 
     /* 加载qss */
-    QFile file = QString(":/Calendar/CalendarNav.qss");
+    QFile file = QString(":/Calendar/qss/CalendarNav_light.qss");
     if(!file.open(QIODevice::ReadOnly))
     {
         qDebug() << "CalendarNav.cpp:QSS打开失败";

+ 8 - 0
TransmitterSwitch/common/date/calendarwidgetex.cpp

@@ -312,6 +312,14 @@ void CalendarWidgetEx::initSkinColor()
         m_hoverBlockColor = HOVER_BRIGHT;
         break;
     case eDarkStyle:
+        m_normalTextColor = NORMAL_TEXT_DEEP;
+        m_todayTextColor = TODAY_TEXT_DEEP;
+        m_selectTextColor = SELECT_TEXT_DEEP;
+        m_disableTextColor = DISABLE_TEXT_DEEP;
+        m_splitLineColor = SPLIT_LINE_DEEP;
+        m_selectBlockColor = SELECT_DEEP;
+        m_hoverBlockColor = HOVER_DEEP;
+        
         break;
     default:
         break;

+ 18 - 0
TransmitterSwitch/common/date/calendarwidgetex.h

@@ -54,6 +54,7 @@ public:
 private slots:
     void OnClicked(const QDate &date);
 private:
+    /* 亮色 */
     const QColor NORMAL_TEXT_BRIGHT{QColor(58,63,99)};
     const QColor TODAY_TEXT_BRIGHT{QColor(68,88,254)};
     const QColor SELECT_TEXT_BRIGHT{Qt::white};
@@ -61,6 +62,23 @@ private:
     const QColor SPLIT_LINE_BRIGHT{QColor(0, 0, 0, 23)};
     const QColor SELECT_BRIGHT{QColor(68, 88, 254)};
     const QColor HOVER_BRIGHT{QColor(227, 238, 255)};
+    /* 暗色 */
+    const QColor NORMAL_TEXT_DEEP{QColor(255,255,255,230)};
+    const QColor TODAY_TEXT_DEEP{Qt::white};
+    const QColor SELECT_TEXT_DEEP{Qt::white};
+    const QColor DISABLE_TEXT_DEEP{QColor(255,255,255,77)};
+    const QColor SPLIT_LINE_DEEP{QColor(255,255,255,64)};
+    const QColor SELECT_DEEP{QColor(233, 161, 18)};
+    const QColor HOVER_DEEP{QColor(132, 134, 136)};
+    
+    const QColor TODAY_DEEP{QColor(67, 142, 255)};
+    const QColor BG_PEN_DEEP{QColor(255,255,255,51)};
+    const QColor BG_BRUSH_DEEP{QColor{116,117,120}};
+    const QColor BG_SPECIAL_PEN_DEEP{QColor{27, 186, 102}};
+    const QColor BG_SPECIAL_BRUSH_DEEP{QColor{78, 112, 97}};
+
+
+
     const int DEFAULT_FONT_SIZE = 14;
     const int TEXT_WIDTH = 24;
     const qreal WINDOW_RADIUS = 2.0;

+ 20 - 1
TransmitterSwitch/common/date/cdate.cpp

@@ -5,6 +5,7 @@
 #include <QEvent>
 #include <QDebug>
 #include <QMouseEvent>
+#include <QEventLoop>
 
 #include "calendarwidgetex.h"
 #include "oneshadow.h"
@@ -29,6 +30,23 @@ CDate::CDate(QWidget *parent,PopupType type) :
     init(QDate::currentDate());
 }
 
+/* 阻塞执行 */
+QDate CDate::execShow()
+{
+    this->show();
+    QEventLoop loop;
+    connect(this, &CDate::signal_close, &loop, &QEventLoop::quit);
+    loop.exec();
+    return m_date;
+}
+
+/* 设置日期 */
+void CDate::setDate(const QDate& date)
+{
+    m_date = date;
+    m_calendarEx->setSelectedDate(date);
+}
+
 void CDate::paintEvent(QPaintEvent *event)
 {
     QPainter painter(this);
@@ -57,9 +75,9 @@ bool CDate::eventFilter(QObject *watched, QEvent *event)
                 if(!gRect.contains(me->globalPos()))
                 {
 //                    qDebug() << QTime::currentTime() << "CDate关闭了";
+                    emit signal_DateChanged(m_date);
                     /* 发送信号,关闭自身 */
                     emit signal_close();
-                    emit signal_DateChanged(m_date);
                     this->close();
                 }
             }
@@ -106,6 +124,7 @@ void CDate::init(const QDate &defaultDate)
     connect(m_calendarEx,&CalendarWidgetEx::clicked,this,[this](const QDate& date){
         m_date = date;
         emit signal_DateChanged(date);
+        emit signal_close();
         this->close();
     });
 

+ 8 - 0
TransmitterSwitch/common/date/cdate.h

@@ -33,6 +33,14 @@ public:
     };
     CDate(const QDate& defaultDate,QWidget *parent = nullptr,PopupType type = Popup);
     CDate(QWidget *parent = nullptr,PopupType type = Popup);
+
+    /* 阻塞执行 */
+    QDate execShow();
+    /* 设置日期 */
+    void setDate(const QDate& date);
+    /* 获取日期 */
+    QDate getDate() const { return m_date; }
+
 signals:
     void signal_DateChanged(const QDate& date);
     void signal_close();

BIN
TransmitterSwitch/common/date/icon/dark/nextMonth.png


BIN
TransmitterSwitch/common/date/icon/dark/nextMonth_hover.png


BIN
TransmitterSwitch/common/date/icon/dark/nextYear.png


BIN
TransmitterSwitch/common/date/icon/dark/nextYear_hover.png


BIN
TransmitterSwitch/common/date/icon/dark/preMonth.png


BIN
TransmitterSwitch/common/date/icon/dark/preMonth_hover.png


BIN
TransmitterSwitch/common/date/icon/dark/preYear.png


BIN
TransmitterSwitch/common/date/icon/dark/preYear_hover.png


+ 0 - 0
TransmitterSwitch/common/date/nextMonth.png → TransmitterSwitch/common/date/icon/light/nextMonth.png


+ 0 - 0
TransmitterSwitch/common/date/nextMonth_hover.png → TransmitterSwitch/common/date/icon/light/nextMonth_hover.png


+ 0 - 0
TransmitterSwitch/common/date/nextYear.png → TransmitterSwitch/common/date/icon/light/nextYear.png


+ 0 - 0
TransmitterSwitch/common/date/nextYear_hover.png → TransmitterSwitch/common/date/icon/light/nextYear_hover.png


+ 0 - 0
TransmitterSwitch/common/date/preMonth.png → TransmitterSwitch/common/date/icon/light/preMonth.png


+ 0 - 0
TransmitterSwitch/common/date/preMonth_hover.png → TransmitterSwitch/common/date/icon/light/preMonth_hover.png


+ 0 - 0
TransmitterSwitch/common/date/preYear.png → TransmitterSwitch/common/date/icon/light/preYear.png


+ 0 - 0
TransmitterSwitch/common/date/preYear_hover.png → TransmitterSwitch/common/date/icon/light/preYear_hover.png


+ 56 - 0
TransmitterSwitch/common/date/qss/CalendarNav_dark.qss

@@ -0,0 +1,56 @@
+
+QWidget
+{
+	background-color: #747578;
+}
+
+QPushButton#btnPrevYear::hover
+{
+	image: url(:/Calendar/icon/dark/preYear.png);
+	border:none;
+}
+QPushButton#btnPrevYear
+{
+	image: url(:/Calendar/icon/dark/preYear_hover.png);
+	border:none;
+}
+
+QPushButton#btnPrevMonth::hover
+{
+	image: url(:/Calendar/icon/dark/preMonth.png);
+	border:none;
+}
+QPushButton#btnPrevMonth
+{
+	image: url(:/Calendar/icon/dark/preMonth_hover.png);
+	border:none;
+}
+
+QPushButton#btnNextMonth::hover
+{
+	image: url(:/Calendar/icon/dark/nextMonth.png);
+	border:none;
+}
+QPushButton#btnNextMonth
+{
+	image: url(:/Calendar/icon/dark/nextMonth_hover.png);
+	border:none;
+}
+
+QPushButton#btnNextYear::hover
+{
+	image: url(:/Calendar/icon/dark/nextYear.png);
+	border:none;
+}
+QPushButton#btnNextYear
+{
+	image: url(:/Calendar/icon/dark/nextYear_hover.png);
+	border:none;
+}
+
+QLabel 
+{
+	font-size: 14px;
+	font-weight: 500;
+	color: #3A3F63;
+}

+ 8 - 8
TransmitterSwitch/common/date/CalendarNav.qss → TransmitterSwitch/common/date/qss/CalendarNav_light.qss

@@ -1,44 +1,44 @@
 QPushButton#btnPrevYear::hover
 {
-	image: url(:/Calendar/preYear.png);
+	image: url(:/Calendar/image/preYear.png);
 	border:none;
 }
 QPushButton#btnPrevYear
 {
-	image: url(:/Calendar/preYear_hover.png);
+	image: url(:/Calendar/image/preYear_hover.png);
 	border:none;
 }
 
 QPushButton#btnPrevMonth::hover
 {
-	image: url(:/Calendar/preMonth.png);
+	image: url(:/Calendar/image/preMonth.png);
 	border:none;
 }
 QPushButton#btnPrevMonth
 {
-	image: url(:/Calendar/preMonth_hover.png);
+	image: url(:/Calendar/image/preMonth_hover.png);
 	border:none;
 }
 
 QPushButton#btnNextMonth::hover
 {
-	image: url(:/Calendar/nextMonth.png);
+	image: url(:/Calendar/image/nextMonth.png);
 	border:none;
 }
 QPushButton#btnNextMonth
 {
-	image: url(:/Calendar/nextMonth_hover.png);
+	image: url(:/Calendar/image/nextMonth_hover.png);
 	border:none;
 }
 
 QPushButton#btnNextYear::hover
 {
-	image: url(:/Calendar/nextYear.png);
+	image: url(:/Calendar/image/nextYear.png);
 	border:none;
 }
 QPushButton#btnNextYear
 {
-	image: url(:/Calendar/nextYear_hover.png);
+	image: url(:/Calendar/image/nextYear_hover.png);
 	border:none;
 }
 

+ 18 - 9
TransmitterSwitch/common/date/rescalendar.qrc

@@ -1,13 +1,22 @@
 <RCC>
     <qresource prefix="/Calendar">
-        <file>nextMonth.png</file>
-        <file>nextMonth_hover.png</file>
-        <file>nextYear.png</file>
-        <file>nextYear_hover.png</file>
-        <file>preMonth.png</file>
-        <file>preMonth_hover.png</file>
-        <file>preYear.png</file>
-        <file>preYear_hover.png</file>
-        <file>CalendarNav.qss</file>
+        <file>icon/light/nextMonth.png</file>
+        <file>icon/light/nextMonth_hover.png</file>
+        <file>icon/light/nextYear.png</file>
+        <file>icon/light/nextYear_hover.png</file>
+        <file>icon/light/preMonth.png</file>
+        <file>icon/light/preMonth_hover.png</file>
+        <file>icon/light/preYear.png</file>
+        <file>icon/light/preYear_hover.png</file>
+        <file>icon/dark/nextMonth.png</file>
+        <file>icon/dark/nextMonth_hover.png</file>
+        <file>icon/dark/nextYear.png</file>
+        <file>icon/dark/nextYear_hover.png</file>
+        <file>icon/dark/preMonth.png</file>
+        <file>icon/dark/preMonth_hover.png</file>
+        <file>icon/dark/preYear.png</file>
+        <file>icon/dark/preYear_hover.png</file>
+        <file>qss/CalendarNav_light.qss</file>
+        <file>qss/CalendarNav_dark.qss</file>
     </qresource>
 </RCC>

+ 205 - 0
TransmitterSwitch/common/warning/warning copy.ui_

@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Warning</class>
+ <widget class="QDialog" name="Warning">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>448</width>
+    <height>249</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">QDialog#Warning
+{
+background:transparent;
+}</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>16</number>
+   </property>
+   <property name="topMargin">
+    <number>16</number>
+   </property>
+   <property name="rightMargin">
+    <number>16</number>
+   </property>
+   <property name="bottomMargin">
+    <number>16</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widget" native="true">
+     <property name="styleSheet">
+      <string notr="true">QWidget{
+background: #FFFFFF;
+border-radius: 8px;
+font-family: 思源黑体R;
+font-weight: 400;
+font-size: 18px;
+color: #3A3F63;
+line-height: 21px;
+text-align: left;
+font-style: normal;
+}
+
+QLabel#label_NC1
+{
+font-family: 思源黑体M;
+font-weight: bold;
+font-size: 18px;
+color: #3A3F63;
+line-height: 27px;
+text-transform: uppercase;
+}
+
+QLabel#label_line
+{
+background: #E6E9F4;
+}
+
+QLabel#label_Warn
+{
+	
+}
+
+QPushButton#pBtn_close{
+	border-image: url(:/ESM-8C_ICON/Dialog_close.png);
+}
+QPushButton#pBtn_close:hover{
+	
+	border-image: url(:/ESM-8C_ICON/Dialog_close2.png);
+}
+
+QPushButton
+{
+	background: #FFFFFF;
+	border: 1px solid #E6E9F4;
+	text-align: center;
+}
+
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+}
+</string>
+     </property>
+     <widget class="QLabel" name="label_NC1">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>18</y>
+        <width>90</width>
+        <height>18</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>提示</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_line">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>56</y>
+        <width>416</width>
+        <height>1</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_close">
+      <property name="geometry">
+       <rect>
+        <x>368</x>
+        <y>12</y>
+        <width>32</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_Warn">
+      <property name="geometry">
+       <rect>
+        <x>40</x>
+        <y>78</y>
+        <width>331</width>
+        <height>61</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>删除该设备,“执行计划”中与之对应的计划也会删除!</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_cancel">
+      <property name="geometry">
+       <rect>
+        <x>248</x>
+        <y>153</y>
+        <width>60</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>取消</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_ok">
+      <property name="geometry">
+       <rect>
+        <x>324</x>
+        <y>153</y>
+        <width>60</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>确定</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 112 - 0
TransmitterSwitch/common/warning/warning.cpp

@@ -0,0 +1,112 @@
+#include "warning.h"
+#include "ui_warning.h"
+
+#include <QPainter>
+#include <QLayout>
+#include <QDebug>
+
+
+#include "spdlog/spdlog.h"
+#include "oneshadow.h"
+
+Warning::Warning(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::Warning)
+{
+    ui->setupUi(this);
+    /* 设置无边框和背景透明 */
+    this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
+    this->setAttribute(Qt::WA_TranslucentBackground);
+
+    /* 设置文字自动换行 */
+    ui->label_Warn->setWordWrap(true);
+    /* 设置文本居中 */
+    // ui->label_Warn->setAlignment(Qt::AlignCenter);
+    ui->label_Warn->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
+    /* 加载警告图标 */
+    ui->label_warnIcon->setStyleSheet(R"(border-image: url(:/ESM-8C_ICON/Tip/Tips2x.png);)");
+
+    /* 阴影宽度是16 */
+    this->layout()->setMargin(SHADOW_W);
+    m_shadow = new OneShadow(QSize(width() - SHADOW_W*2, height() - SHADOW_W*2),SHADOW_W);
+
+    connect(ui->pBtn_close,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_cancel,SIGNAL(clicked()),this,SLOT(close()));
+    connect(ui->pBtn_ok,SIGNAL(clicked()),this,SLOT(do_ok()));
+}
+
+Warning::~Warning()
+{
+    delete ui;
+}
+
+void Warning::setText(const QString &text)
+{
+    /* 根据文本大小设置高度 */
+    ui->label_Warn->setText(text);
+    /* 重新设置位置 */
+    resetLabelSize();
+    moveWarnICON();
+}
+
+/* 只有一个确定按钮 */
+void Warning::setTextWithOneButton(const QString &text)
+{
+    ui->pBtn_cancel->hide();
+    // ui->pBtn_ok->move(ui->pBtn_cancel->x(),ui->pBtn_cancel->y());
+    ui->label_Warn->setText(text);
+    /* 重新设置位置 */
+    resetLabelSize();
+    moveWarnICON();
+}
+
+void Warning::paintEvent(QPaintEvent *event)
+{
+    QPainter painter(this);
+    painter.setRenderHint(QPainter::Antialiasing);
+    /* 绘制阴影 */
+    painter.drawImage(QPoint(0,0),m_shadow->image());
+}
+
+
+
+void Warning::do_ok()
+{
+    emit signal_ok();
+    m_isOk = true;
+    this->close();
+}
+
+/**
+ * @brief 重新设置显示文字的区域大小,主要是设置宽度,为计算出左侧的图标位置
+ *        字号是18,每个汉字的宽度、高度都是18,行高是27。
+ *        文字显示区域最大宽度是306,显示17个汉字。
+ *        阴影宽度是16,需要加上阴影宽度的坐标。
+ * 
+ */
+void Warning::resetLabelSize()
+{
+    int TextCount = ui->label_Warn->text().count();
+    int width = TextCount * 18;
+    if(width > 306)
+    {
+        width = 306;
+    }
+    // ui->label_Warn->setFixedWidth(width);
+    ui->label_Warn->resize(width, ui->label_Warn->height());
+    /* ui->widget是布局确定的大小,获取它的大小不准确 */
+    int widgetWidth = this->width();
+    int x = (widgetWidth - width) / 2;
+    // int x = (widgetWidth - width - ui->label_warnIcon->width() - 12) / 2;
+    // x = x + ui->label_warnIcon->width() + 12; /* 加上图标的宽度,和图标之间的间距 */
+    ui->label_Warn->move(x, ui->label_Warn->y());
+}
+
+
+/* 移动警告图标 */
+void Warning::moveWarnICON()
+{
+    int x = ui->label_Warn->x() - ui->label_warnIcon->width() - 12;
+    int y = ui->label_Warn->y() + ui->label_Warn->height() / 2 - ui->label_warnIcon->height() / 2;
+    ui->label_warnIcon->move(x,y);
+}

+ 46 - 0
TransmitterSwitch/common/warning/warning.h

@@ -0,0 +1,46 @@
+#ifndef WARNING_H
+#define WARNING_H
+
+#include <QDialog>
+
+class OneShadow;
+
+namespace Ui {
+class Warning;
+}
+
+class Warning : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit Warning(QWidget *parent = nullptr);
+    ~Warning();
+
+    void setText(const QString& text);
+    void setTextWithOneButton(const QString& text);     /* 只有一个确定按钮 */
+    bool isOk() const { return m_isOk; }
+signals:
+    void signal_ok();
+
+protected:
+    void paintEvent(QPaintEvent *event);
+
+private slots:
+    void do_ok();
+
+private:
+    /* 重新设置显示文字的区域大小 */
+    void resetLabelSize();
+    /* 移动警告图标 */
+    void moveWarnICON();
+
+private:
+    Ui::Warning *ui;
+
+    OneShadow* m_shadow = nullptr;
+    const int SHADOW_W = 16;                /* 阴影的大小 */
+    bool m_isOk = false;
+};
+
+#endif // WARNING_H

+ 222 - 0
TransmitterSwitch/common/warning/warning.ui

@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Warning</class>
+ <widget class="QDialog" name="Warning">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>440</width>
+    <height>302</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">QDialog#Warning
+{
+background:transparent;
+}</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>16</number>
+   </property>
+   <property name="topMargin">
+    <number>16</number>
+   </property>
+   <property name="rightMargin">
+    <number>16</number>
+   </property>
+   <property name="bottomMargin">
+    <number>16</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widget" native="true">
+     <property name="styleSheet">
+      <string notr="true">QWidget{
+background: #FFFFFF;
+border-radius: 8px;
+font-family: 思源黑体R;
+font-weight: 400;
+font-size: 18px;
+color: #3A3F63;
+line-height: 21px;
+text-align: left;
+font-style: normal;
+}
+
+QLabel#label_NC1
+{
+font-family: 思源黑体M;
+font-weight: bold;
+font-size: 18px;
+color: #3A3F63;
+line-height: 27px;
+text-transform: uppercase;
+}
+
+QLabel#label_line
+{
+background: #E6E9F4;
+}
+
+QLabel#label_Warn
+{
+	font-family: 思源黑体R;
+	font-weight: 400;
+	font-size: 18px;
+	color: #3A3F63;
+	line-height: 27px;
+}
+
+QPushButton#pBtn_close{
+	border-image: url(:/ESM-8C_ICON/Dialog_close.png);
+}
+QPushButton#pBtn_close:hover{
+	
+	border-image: url(:/ESM-8C_ICON/Dialog_close2.png);
+}
+
+QPushButton
+{
+	background: #FFFFFF;
+	border: 1px solid #E6E9F4;
+	text-align: center;
+}
+
+
+/********* 普通方框按钮三种状态效果 *********/
+QPushButton#pBtn_cancel
+{
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #E6E9F4;
+    color: #3A3F63;
+}
+QPushButton#pBtn_cancel:hover
+{
+    background: #FFFFFF;
+    border-radius: 16px;
+    border: 1px solid #4458FE;
+    color: #4458FE;
+}
+
+/********* 带有底色按钮三种状态效果 *********/
+QPushButton#pBtn_ok
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:1 #4F8AFF,stop:0 #4B5EFF);
+    border-radius: 16px;
+}
+
+QPushButton#pBtn_ok:hover
+{
+    color:white;
+    background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
+    border-radius: 16px;
+}
+</string>
+     </property>
+     <widget class="QLabel" name="label_NC1">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>18</y>
+        <width>90</width>
+        <height>18</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>提示</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_line">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>56</y>
+        <width>416</width>
+        <height>1</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_close">
+      <property name="geometry">
+       <rect>
+        <x>368</x>
+        <y>12</y>
+        <width>32</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_Warn">
+      <property name="geometry">
+       <rect>
+        <x>50</x>
+        <y>78</y>
+        <width>308</width>
+        <height>120</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>删除该设备,“执行计划”中与之对应的计划也会删除!</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_cancel">
+      <property name="geometry">
+       <rect>
+        <x>248</x>
+        <y>216</y>
+        <width>60</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>取消</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_ok">
+      <property name="geometry">
+       <rect>
+        <x>324</x>
+        <y>216</y>
+        <width>60</width>
+        <height>32</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>确定</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_warnIcon">
+      <property name="geometry">
+       <rect>
+        <x>10</x>
+        <y>130</y>
+        <width>20</width>
+        <height>20</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 150 - 17
TransmitterSwitch/transmitterswitch.cpp

@@ -15,6 +15,8 @@
 #include "oneitem.h"
 #include "ItemData.h"
 #include "timewidget.h"
+#include "cdate.h"
+
 
 TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
     QWidget(parent),
@@ -51,6 +53,8 @@ TransmitterSwitch::TransmitterSwitch(QWidget *parent) :
     /* 连接信号和槽 */
     connect(ui->pBtn_addPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_pBtnAddExecPlan);
     connect(ui->pBtn_importPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_importData);
+    connect(ui->pBtn_exportPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_exportData);
+    connect(ui->pBtn_clearPlan, &QPushButton::clicked, this, &TransmitterSwitch::do_clearCurrentPage);
 }
 
 TransmitterSwitch::~TransmitterSwitch()
@@ -100,11 +104,76 @@ void TransmitterSwitch::setWebAPIInfo(const QString &url, const QString &serverI
         LH_WRITE_ERROR("WebAPI info is empty");
         return;
     }
-    m_fromWebAPI->initWebApi(url,serverID,serverKey);
+    m_fromWebAPI->initWebApi(url, serverID, serverKey);
     /* 获取支持的设备 */
     m_fromWebAPI->getDeviceInfo(DeviceContainer.getMapDevice());
 }
 
+/* 获取EQM数据库计划 */
+void TransmitterSwitch::getExecPlanFromEQM()
+{
+    /* 清空本地的计划数据 */
+    IData.clearAllItem();
+
+    QList<ExecPlanItemInfo> list;
+    m_fromWebAPI->getExecPlanData(list);
+
+    /* 添加计划项 */
+    for(const auto& it : list)
+    {
+        if (it.WeekDay < 8 || it.WeekDay < 1)
+        {
+            addNormalOneItem(it.WeekDay - 1, it.devName, it.actionName, it.execTime);
+        }
+        else if(it.WeekDay == 8)
+        {
+            addSpecialOneItem(it.WeekDay - 1, it.devName, it.actionName, it.date, it.execTime);
+        
+        }
+    }
+    /* 排序 */
+    for(int i = 0; i < 8; ++i)
+    {
+        sortLayout(i);
+    }
+}
+
+/* 将计划保存到EQM数据库 */
+void TransmitterSwitch::saveExecPlanToEQM()
+{
+    QList<ExecPlanItemInfo> list;
+    /* 获取当前计划的执行模式 */
+    int execType = 0;
+    if(ui->rBtn_moment->isChecked())
+    {
+        execType = 0;
+    } else
+    {
+        execType = 1;
+    }
+    for(const auto& it : IData.getMapItem())
+    {
+        for(const auto& it1 : *it)
+        {
+            ExecPlanItemInfo info;
+            info.ExecType = execType;
+            info.devName = it1->getDevName();
+            info.actionID = it1->getActionNum();
+            info.actionName = it1->getActionNum();
+            info.execTime = it1->getExecTime();
+            info.date = it1->getDate();
+            info.WeekDay = it1->getWeekDay() + 1;
+            list.push_back(info);
+        }
+    }
+    /* 判断计划条数,如果为0就阻止 */
+    if(list.size() == 0)
+    {
+        return;
+    }
+    m_fromWebAPI->insertData(list);
+}
+
 
 /* 每周几的按钮点击了,设置stackedWidegt页面 */
 void TransmitterSwitch::do_weekpBtn_clicked()
@@ -169,6 +238,8 @@ void TransmitterSwitch::do_pBtnAddExecPlan()
             addSpecialOneItem(weekDay, atf->getDevName(), atf->getAction(), atf->getDate(), atf->getTime());
         }
     }
+    /* 排序 */
+    sortLayout(ui->stackedWidget_items->currentIndex());
 }
 
 
@@ -255,11 +326,66 @@ void TransmitterSwitch::do_editExecTime(QTime t)
     sortLayout(one->getWeekDay());
 }
 
+
+/* 点击修改日期 */
+void TransmitterSwitch::do_editExecDate(QDate d)
+{
+    /* 获取信号发送者 */
+    auto one = qobject_cast<OneItem*>(sender());
+    /* 创建时间选择控件 */
+    std::shared_ptr<CDate> cd = std::make_shared<CDate>(this);
+
+    /* 移动位置,日历弹窗没有编辑栏,只有选择日历的时间,日历弹窗自带16px的阴影 */
+    auto pos = one->mapTo(this, one->getExecDatePos());
+    pos.setY(pos.y() + 32);     /* 去掉时间显示栏的高度 */
+    pos.setX(pos.x() - 16);     /* 去掉阴影的宽度 */
+
+    cd->move(pos);
+    /* 设置默认的日期 */
+    cd->setDate(d);
+
+    cd->execShow();
+    /* 获取日期 */
+    auto date = cd->getDate();
+    LH_WRITE_LOG_DEBUG(QString("选择日期:%1").arg(date.toString("yyyy-MM-dd")));
+    /* 判断日期有没有修改 */
+    if(date == d)
+    {
+        return;
+    }
+    one->setDate(date);
+    /* 判断日期时间是否重复 */
+    if(IData.judgeDateTimeRepetitionWithEdit(one->getWeekDay(), one, date, one->getExecTime()))
+    {
+        /* 设置时间报警 */
+        one->setWarningText("设备执行日期时间冲突", -1);
+        return;
+    }
+    /* 取消报警 */
+    one->hideWarn();
+    /* 重新排序 */
+    sortLayout(one->getWeekDay());
+
+}
+
 /* 导入数据 */
 void TransmitterSwitch::do_importData()
 {
-    QList<ExecPlanItemInfo> list;
-    m_fromWebAPI->getExecPlanData(list);
+    
+}
+
+/* 导出数据 */
+void TransmitterSwitch::do_exportData()
+{
+    
+}
+
+/* 清空当前页计划 */
+void TransmitterSwitch::do_clearCurrentPage()
+{
+    int weekDay = ui->stackedWidget_items->currentIndex();
+    IData.clearOneDay(weekDay);
+    sortLayout(weekDay);
 }
 
 
@@ -330,7 +456,7 @@ void TransmitterSwitch::createWeekWidget()
 /* 添加一个正常日的计划 */
 void TransmitterSwitch::addNormalOneItem(int week, QString devName, QString action, QTime execTime)
 {
-    OneItem* one = new OneItem();
+    OneItem* one = new OneItem(false);
     /* 添加可选的设备 */
     one->addDevice();
     /* 设置最小高度 */
@@ -346,32 +472,44 @@ void TransmitterSwitch::addNormalOneItem(int week, QString devName, QString acti
 
     /* 添加到容器中 */
     IData.addOneItem(week, one);
-    /* 重新排序 */
-    sortLayout(week);
 }
 
 /* 添加一项特殊日计划 */
 void TransmitterSwitch::addSpecialOneItem(int week, QString devName, QString action, QDate date, QTime execTime)
 {
+    OneItem* one = new OneItem(true);
+    /* 添加可选的设备 */
+    one->addDevice();
+    /* 设置最小高度 */
+    // one->setMinimumHeight(48);
+    one->setDevName(devName);
+    one->setDate(date);
+    one->setExecTime(execTime);
+    one->setWeekDay(week);
 
+    /* 连接删除项信号,执行时间改变信号 */
+    connect(one, &OneItem::signal_OneItemDelete, this, &TransmitterSwitch::do_deleteOneItem);
+    connect(one, &OneItem::signal_devChanged, this, &TransmitterSwitch::do_changeDev);
+    connect(one, &OneItem::signal_execTimeClicked, this, &TransmitterSwitch::do_editExecTime);
+    connect(one, &OneItem::signal_dateClicked, this, &TransmitterSwitch::do_editExecDate);
+
+    /* 添加到容器中 */
+    IData.addOneItem(week, one);
 }
 
 /* 重新排序布局 */
 void TransmitterSwitch::sortLayout(int weekDay)
 {
-    if(weekDay < 7 && weekDay >= 0)
+    if(weekDay < 8 && weekDay >= 0)
     {
-        sortNormalDayData(weekDay);
-    }else if(weekDay == 7)
-    {
-        sortSpecialDayData();
+        sortItemData(weekDay);
     }
     /* 重新布局 */
     sortLayoutUI(weekDay);
 }
 
 /* 排序正常日 */
-void TransmitterSwitch::sortNormalDayData(int weekDay)
+void TransmitterSwitch::sortItemData(int weekDay)
 {
     /* 获取当前页容器 */
     auto list = IData.getOneDay(weekDay);
@@ -416,11 +554,6 @@ void TransmitterSwitch::sortNormalDayData(int weekDay)
     }
 }
 
-/* 排序特殊日 */
-void TransmitterSwitch::sortSpecialDayData()
-{
-
-}
 
 /* 重新布局项 */
 void TransmitterSwitch::sortLayoutUI(int weekDay)

+ 11 - 4
TransmitterSwitch/transmitterswitch.h

@@ -25,6 +25,10 @@ public:
     void setQSS(const QString &qssPath);
     /* 设置WebAPI信息 */
     void setWebAPIInfo(const QString &url, const QString &serverID, const QString &serverKey);
+    /* 获取EQM数据库计划 */
+    void getExecPlanFromEQM();
+    /* 将计划保存到EQM数据库 */
+    void saveExecPlanToEQM();
 
 private slots:
     /* 每周几的按钮点击了,设置stackedWidegt页面 */
@@ -38,10 +42,15 @@ private slots:
     void do_changeDev();
     /* 点击修改执行时间 */
     void do_editExecTime(QTime t);
-
+    /* 点击修改日期 */
+    void do_editExecDate(QDate d);
 
     /* 导入数据 */
     void do_importData();
+    /* 导出数据 */
+    void do_exportData();
+    /* 清空当前页计划 */
+    void do_clearCurrentPage();
 
 private:
     /* 创建一周8天的item页面 */
@@ -54,9 +63,7 @@ private:
     /* 重新排序布局 */
     void sortLayout(int weekDay);
     /* 排序正常日 */
-    void sortNormalDayData(int weekDay);
-    /* 排序特殊日 */
-    void sortSpecialDayData();
+    void sortItemData(int weekDay);
     /* 重新布局项 */
     void sortLayoutUI(int weekDay);
 

+ 4 - 0
show1/CMakeLists.txt

@@ -17,6 +17,8 @@ file(GLOB LOCAL_SRC
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/UserData/*.cpp
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/AddItem/*.cpp
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/ItemData/*.cpp
+    # ${CMAKE_SOURCE_DIR}/TransmitterSwitch/Template/*.cpp
+    ${CMAKE_SOURCE_DIR}/TransmitterSwitch/warnning/*.cpp
 
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/Shadow/*.cpp
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/ImageBlur/*.cpp
@@ -52,6 +54,8 @@ target_include_directories(${execName1} PRIVATE
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/UserData
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/AddItem
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/ItemData
+    # ${CMAKE_SOURCE_DIR}/TransmitterSwitch/Template
+    ${CMAKE_SOURCE_DIR}/TransmitterSwitch/warnning
 
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common
     ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/nlohmann

+ 29 - 3
show1/widget.cpp

@@ -2,18 +2,21 @@
 #include "ui_widget.h"
 
 #include "LHQLogAPI.h"
+#include "common/StyleManager/lhstylemanager.h"
 
 Widget::Widget(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::Widget)
 {
     ui->setupUi(this);
+    /* 设置暗色 */
+    // LHStyleMgr->SetSkinStyle("Dark");
 
-    m_tSwitch = new TransmitterSwitch(this);
+    m_tSwitch = new TransmitterSwitch();
     /* 设置一个布局 */
-    m_layout = new QVBoxLayout(this);
+    m_layout = new QVBoxLayout(ui->widget_content);
     m_layout->addWidget(m_tSwitch);
-    setLayout(m_layout);
+    ui->widget_content->setLayout(m_layout);
     /* 设置边距为0 */
     m_layout->setMargin(20);
     m_layout->setSpacing(0);
@@ -40,3 +43,26 @@ Widget::~Widget()
     }
     delete ui;
 }
+
+
+/* 导入数据按钮 */
+void Widget::on_pBtn_getData_clicked()
+{
+    if(m_tSwitch == nullptr)
+    {
+        LH_WRITE_ERROR("TransmitterSwitch is nullptr");
+        return;
+    }
+    m_tSwitch->getExecPlanFromEQM();
+}
+
+/* 导出数据按钮 */
+void Widget::on_pBtn_saveData_clicked()
+{
+    if(m_tSwitch == nullptr)
+    {
+        LH_WRITE_ERROR("TransmitterSwitch is nullptr");
+        return;
+    }
+    m_tSwitch->saveExecPlanToEQM();
+}

+ 6 - 0
show1/widget.h

@@ -20,6 +20,12 @@ public:
     explicit Widget(QWidget *parent = nullptr);
     ~Widget();
 
+private slots:
+    /* 导入数据按钮 */
+    void on_pBtn_getData_clicked();
+    /* 导出数据按钮 */
+    void on_pBtn_saveData_clicked();
+
 private:
     Ui::Widget *ui;
 

+ 62 - 0
show1/widget.ui

@@ -13,6 +13,68 @@
   <property name="windowTitle">
    <string>Form</string>
   </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWidget" name="widget_content" native="true"/>
+   </item>
+   <item>
+    <widget class="QWidget" name="widget_control" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>80</height>
+      </size>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QPushButton" name="pBtn_getData">
+        <property name="minimumSize">
+         <size>
+          <width>120</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>获取数据</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_saveData">
+        <property name="minimumSize">
+         <size>
+          <width>120</width>
+          <height>32</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>写入数据库</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>1619</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
  <connections/>