zenglf
2023-09-28 997835429a1d66643364091e8437ebbbeb8ff97a
src/views/mdc/base/modules/HolidayManagement/HolidayManagementList.vue
@@ -19,15 +19,12 @@
              <a-input placeholder="输入设备名称查询" v-model="queryParams.equipmentName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="2" :sm="3" :xs="3">
          <a-col :md="2" :sm="2" :xs="2">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
          </a-col>
          <a-col :md="2" :sm="2" :xs="2">
            <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
          </a-col>
          <!--<a-col :lg="2" :md="3" :sm="3" :xs="3">-->
            <!--<a-button type="primary" @click="exportExcel" icon="download">导出</a-button>-->
          <!--</a-col>-->
        </a-row>
      </a-form>
    </div>
@@ -35,10 +32,23 @@
    <div class="table-operator" style="display: inline;">
      <a-button @click="handleAdd" type="primary" icon="plus">新增
      </a-button>
      <!--<a-button type="primary" icon="download" @click="handleExportXls('假期管理')">导出</a-button>-->
      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
      <!--<a-button type="primary" icon="import">导入</a-button>-->
      <!--</a-upload>-->
      <a-button type="primary" icon="download" @click="importTemplate('假期管理模板')">导入模板</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('假期管理')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
      <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
@@ -147,7 +157,7 @@
          {
            title: '类型',
            align: 'center',
            dataIndex: 'type'
            dataIndex: 'vacationType'
          },
          {
            title: '备注',
@@ -164,10 +174,11 @@
        ],
        url: {
          list: '/mdc/mdcVacationManagement/pageList',
          delete: '/mdc/mdcVacationManagement/deleteVacation',
          deleteBatch: '/mdc/mdcVacationManagement/deleteBatchVacation',
          getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid',
          exportXlsUrl: "/mdc/MdcTorqueConfig/exportXls",
          importExcelUrl: "/mdc/MdcTorqueConfig/importExcel",
          exportXlsUrl: "/mdc/mdcVacationManagement/exportXls",
          importExcelUrl: "/mdc/mdcVacationManagement/importExcel",
        }
      }
    },
@@ -289,7 +300,11 @@
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            this.$message.warning(res.message)
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -334,7 +349,11 @@
              this.ipagination.total = 0;
            }
          }else{
            this.$message.warning(res.message)
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -372,7 +391,11 @@
              this.ipagination.total = 0;
            }
          }else{
            this.$message.warning(res.message)
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -414,7 +437,11 @@
              this.ipagination.total = 0;
            }
          }else{
            this.$message.warning(res.message)
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -448,7 +475,11 @@
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            this.$message.warning(res.message)
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
@@ -461,21 +492,86 @@
        this.selectedRowKeys = []
      },
      handleDelete: function (id) {
        if(!this.url.deleteBatch){
        if(!this.url.delete){
          this.$message.error("请设置url.delete属性!")
          return
        }
        var that = this;
        deleteAction(that.url.deleteBatch, {id: id}).then((res) => {
        deleteAction(that.url.delete, {id: id}).then((res) => {
          if (res.success) {
            //重新计算分页问题
            that.reCalculatePage(1)
            that.$message.success(res.message);
            // that.$message.success(res.message);
            that.$notification.success({
              message:'消息',
              description:res.message
            });
            that.searchQuery();
          } else {
            that.$message.warning(res.message);
            // that.$message.warning(res.message);
            that.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        });
      },
      batchDel: function () {
        if(!this.url.deleteBatch){
          this.$message.error("请设置url.deleteBatch属性!")
          return
        }
        if (this.selectedRowKeys.length <= 0) {
          // this.$message.warning('请选择一条记录!');
          this.$notification.warning({
            message:'消息',
            description:"请选择一条记录"
          });
          return;
        } else {
          var ids = "";
          for (var a = 0; a < this.selectedRowKeys.length; a++) {
            ids += this.selectedRowKeys[a] + ",";
          }
          var that = this;
          this.$confirm({
            title: "确认删除",
            content: "是否删除选中数据?",
            onOk: function () {
              that.loading = true;
              deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.success({
                    message:'消息',
                    description:res.message
                  });
                  that.loadData();
                  that.onClearSelected();
                } else {
                  // that.$message.warning(res.message);
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                }
              }).finally(() => {
                that.loading = false;
              });
            }
          });
        }
      },
      importTemplate(fileName){
        var a = document.createElement("a");
        a.href = "/static/假期管理.xls";
        a.download = "假期管理.xls";
        a.style.display = "none";
        document.body.appendChild(a);
        a.click();
        a.remove();
      },
      handleAdd() {
        this.$refs.modalForm.add(this.node)
@@ -507,7 +603,11 @@
              _this.equipment = res.result
              _this.searchQuery()
            } else {
              _this.$message.warning('请配置设备!')
              // _this.$message.warning('请配置设备!')
              _this.$notification.warning({
                message:'消息',
                description:'请联系管理员,开放设备权限!'
              });
            }
          }
        })