admin
2024-11-20 4537f0f9e79f6cbadb3d9114dedd1d2ce1dcead8
Merge remote-tracking branch 'origin/master'
已添加8个文件
792 ■■■■■ 文件已修改
billion-main/src/main/java/com/billion/main/sc/controller/ScOpcConfController.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/java/com/billion/main/sc/domain/ScOpcConf.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/java/com/billion/main/sc/mapper/ScOpcConfMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/java/com/billion/main/sc/service/IScOpcConfService.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/java/com/billion/main/sc/service/impl/ScOpcConfServiceImpl.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/resources/mapper/sc/ScOpcConfMapper.xml 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-ui/src/api/main/sc/opcConf.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-ui/src/views/main/sc/opcConf/index.vue 279 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
billion-main/src/main/java/com/billion/main/sc/controller/ScOpcConfController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,104 @@
package com.billion.main.sc.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.billion.common.annotation.Log;
import com.billion.common.core.controller.BaseController;
import com.billion.common.core.domain.AjaxResult;
import com.billion.common.enums.BusinessType;
import com.billion.main.sc.domain.ScOpcConf;
import com.billion.main.sc.service.IScOpcConfService;
import com.billion.common.utils.poi.ExcelUtil;
import com.billion.common.core.page.TableDataInfo;
/**
 * OPC交互配置Controller
 *
 * @author HDY
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/sc/opcConf")
public class ScOpcConfController extends BaseController
{
    @Autowired
    private IScOpcConfService scOpcConfService;
    /**
     * æŸ¥è¯¢OPC交互配置列表
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:list')")
    @GetMapping("/list")
    public TableDataInfo list(ScOpcConf scOpcConf)
    {
        startPage();
        List<ScOpcConf> list = scOpcConfService.selectScOpcConfList(scOpcConf);
        return getDataTable(list);
    }
    /**
     * å¯¼å‡ºOPC交互配置列表
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:export')")
    @Log(title = "OPC交互配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ScOpcConf scOpcConf)
    {
        List<ScOpcConf> list = scOpcConfService.selectScOpcConfList(scOpcConf);
        ExcelUtil<ScOpcConf> util = new ExcelUtil<ScOpcConf>(ScOpcConf.class);
        util.exportExcel(response, list, "OPC交互配置数据");
    }
    /**
     * èŽ·å–OPC交互配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(scOpcConfService.selectScOpcConfById(id));
    }
    /**
     * æ–°å¢žOPC交互配置
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:add')")
    @Log(title = "OPC交互配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ScOpcConf scOpcConf)
    {
        return toAjax(scOpcConfService.insertScOpcConf(scOpcConf));
    }
    /**
     * ä¿®æ”¹OPC交互配置
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:edit')")
    @Log(title = "OPC交互配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ScOpcConf scOpcConf)
    {
        return toAjax(scOpcConfService.updateScOpcConf(scOpcConf));
    }
    /**
     * åˆ é™¤OPC交互配置
     */
    @PreAuthorize("@ss.hasPermi('sc:opcConf:remove')")
    @Log(title = "OPC交互配置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(scOpcConfService.deleteScOpcConfByIds(ids));
    }
}
billion-main/src/main/java/com/billion/main/sc/domain/ScOpcConf.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
package com.billion.main.sc.domain;
import com.billion.common.annotation.Excel;
import com.billion.main.common.BaseEntity;
import lombok.Data;
/**
 * OPC交互配置对象 sc_opc_conf
 *
 * @author HDY
 * @date 2024-11-20
 */
@Data
public class ScOpcConf extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    /** ä¸»é”®id */
    private Long id;
    /** å·¥ä½ç¼–码 */
    @Excel(name = "工位编码")
    private String locationCode;
    /** å·¥ä½åç§° */
    @Excel(name = "工位名称")
    private String locationName;
    /** åœ°å€ */
    @Excel(name = "地址")
    private String node;
    /** é‡‡é›†ç±»åž‹ */
    @Excel(name = "采集类型")
    private String type;
    /** æ˜¯å¦è®¢é˜… */
    @Excel(name = "是否订阅")
    private String subscribe;
    /** åˆ é™¤æ ‡å¿—(0代表存在 1代表删除) */
    private String delFlag;
}
billion-main/src/main/java/com/billion/main/sc/mapper/ScOpcConfMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.billion.main.sc.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.billion.main.sc.domain.ScOpcConf;
import java.util.List;
/**
 * OPC交互配置Mapper接口
 *
 * @author HDY
 * @date 2024-11-20
 */
public interface ScOpcConfMapper extends BaseMapper<ScOpcConf>
{
    /**
     * æŸ¥è¯¢OPC交互配置
     *
     * @param id OPC交互配置主键
     * @return OPC交互配置
     */
    public ScOpcConf selectScOpcConfById(Long id);
    /**
     * æŸ¥è¯¢OPC交互配置列表
     *
     * @param scOpcConf OPC交互配置
     * @return OPC交互配置集合
     */
    public List<ScOpcConf> selectScOpcConfList(ScOpcConf scOpcConf);
    /**
     * æ–°å¢žOPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    public int insertScOpcConf(ScOpcConf scOpcConf);
    /**
     * ä¿®æ”¹OPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    public int updateScOpcConf(ScOpcConf scOpcConf);
    /**
     * åˆ é™¤OPC交互配置
     *
     * @param id OPC交互配置主键
     * @return ç»“æžœ
     */
    public int deleteScOpcConfById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤OPC交互配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„数据主键集合
     * @return ç»“æžœ
     */
    public int deleteScOpcConfByIds(Long[] ids);
}
billion-main/src/main/java/com/billion/main/sc/service/IScOpcConfService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.billion.main.sc.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.billion.main.sc.domain.ScOpcConf;
import java.util.List;
/**
 * OPC交互配置Service接口
 *
 * @author HDY
 * @date 2024-11-20
 */
public interface IScOpcConfService extends IService<ScOpcConf>
{
    /**
     * æŸ¥è¯¢OPC交互配置
     *
     * @param id OPC交互配置主键
     * @return OPC交互配置
     */
    public ScOpcConf selectScOpcConfById(Long id);
    /**
     * æŸ¥è¯¢OPC交互配置列表
     *
     * @param scOpcConf OPC交互配置
     * @return OPC交互配置集合
     */
    public List<ScOpcConf> selectScOpcConfList(ScOpcConf scOpcConf);
    /**
     * æ–°å¢žOPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    public int insertScOpcConf(ScOpcConf scOpcConf);
    /**
     * ä¿®æ”¹OPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    public int updateScOpcConf(ScOpcConf scOpcConf);
    /**
     * æ‰¹é‡åˆ é™¤OPC交互配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„OPC交互配置主键集合
     * @return ç»“æžœ
     */
    public int deleteScOpcConfByIds(Long[] ids);
    /**
     * åˆ é™¤OPC交互配置信息
     *
     * @param id OPC交互配置主键
     * @return ç»“æžœ
     */
    public int deleteScOpcConfById(Long id);
}
billion-main/src/main/java/com/billion/main/sc/service/impl/ScOpcConfServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
package com.billion.main.sc.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.billion.common.utils.DateUtils;
import com.billion.main.sc.domain.ScOpcConf;
import com.billion.main.sc.mapper.ScOpcConfMapper;
import com.billion.main.sc.service.IScOpcConfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * OPC交互配置Service业务层处理
 *
 * @author HDY
 * @date 2024-11-20
 */
@Service
public class ScOpcConfServiceImpl extends ServiceImpl<ScOpcConfMapper, ScOpcConf> implements IScOpcConfService
{
    @Autowired
    private ScOpcConfMapper scOpcConfMapper;
    /**
     * æŸ¥è¯¢OPC交互配置
     *
     * @param id OPC交互配置主键
     * @return OPC交互配置
     */
    @Override
    public ScOpcConf selectScOpcConfById(Long id)
    {
        return scOpcConfMapper.selectScOpcConfById(id);
    }
    /**
     * æŸ¥è¯¢OPC交互配置列表
     *
     * @param scOpcConf OPC交互配置
     * @return OPC交互配置
     */
    @Override
    public List<ScOpcConf> selectScOpcConfList(ScOpcConf scOpcConf)
    {
        return scOpcConfMapper.selectScOpcConfList(scOpcConf);
    }
    /**
     * æ–°å¢žOPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    @Override
    public int insertScOpcConf(ScOpcConf scOpcConf)
    {
        scOpcConf.setCreateTime(DateUtils.getNowDate());
        return scOpcConfMapper.insertScOpcConf(scOpcConf);
    }
    /**
     * ä¿®æ”¹OPC交互配置
     *
     * @param scOpcConf OPC交互配置
     * @return ç»“æžœ
     */
    @Override
    public int updateScOpcConf(ScOpcConf scOpcConf)
    {
        scOpcConf.setUpdateTime(DateUtils.getNowDate());
        return scOpcConfMapper.updateScOpcConf(scOpcConf);
    }
    /**
     * æ‰¹é‡åˆ é™¤OPC交互配置
     *
     * @param ids éœ€è¦åˆ é™¤çš„OPC交互配置主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteScOpcConfByIds(Long[] ids)
    {
        return scOpcConfMapper.deleteScOpcConfByIds(ids);
    }
    /**
     * åˆ é™¤OPC交互配置信息
     *
     * @param id OPC交互配置主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteScOpcConfById(Long id)
    {
        return scOpcConfMapper.deleteScOpcConfById(id);
    }
}
billion-main/src/main/resources/mapper/sc/ScOpcConfMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.billion.main.sc.mapper.ScOpcConfMapper">
    <resultMap type="ScOpcConf" id="ScOpcConfResult">
        <result property="id"    column="id"    />
        <result property="locationCode"    column="location_code"    />
        <result property="locationName"    column="location_name"    />
        <result property="node"    column="node"    />
        <result property="type"    column="type"    />
        <result property="subscribe"    column="subscribe"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
    <sql id="selectScOpcConfVo">
        select id, location_code, location_name, node, type, subscribe, del_flag, create_by, create_time, update_by, update_time from sc_opc_conf
    </sql>
    <select id="selectScOpcConfList" parameterType="ScOpcConf" resultMap="ScOpcConfResult">
        <include refid="selectScOpcConfVo"/>
        <where>
            <if test="locationCode != null  and locationCode != ''"> and location_code like concat('%', #{locationCode}, '%')</if>
            <if test="locationName != null  and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
            <if test="node != null  and node != ''"> and node like concat('%', #{node}, '%')</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="subscribe != null  and subscribe != ''"> and subscribe = #{subscribe}</if>
        </where>
    </select>
    <select id="selectScOpcConfById" parameterType="Long" resultMap="ScOpcConfResult">
        <include refid="selectScOpcConfVo"/>
        where id = #{id}
    </select>
    <insert id="insertScOpcConf" parameterType="ScOpcConf" useGeneratedKeys="true" keyProperty="id">
        insert into sc_opc_conf
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="locationCode != null">location_code,</if>
            <if test="locationName != null">location_name,</if>
            <if test="node != null">node,</if>
            <if test="type != null">type,</if>
            <if test="subscribe != null">subscribe,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="locationCode != null">#{locationCode},</if>
            <if test="locationName != null">#{locationName},</if>
            <if test="node != null">#{node},</if>
            <if test="type != null">#{type},</if>
            <if test="subscribe != null">#{subscribe},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
    <update id="updateScOpcConf" parameterType="ScOpcConf">
        update sc_opc_conf
        <trim prefix="SET" suffixOverrides=",">
            <if test="locationCode != null">location_code = #{locationCode},</if>
            <if test="locationName != null">location_name = #{locationName},</if>
            <if test="node != null">node = #{node},</if>
            <if test="type != null">type = #{type},</if>
            <if test="subscribe != null">subscribe = #{subscribe},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deleteScOpcConfById" parameterType="Long">
        delete from sc_opc_conf where id = #{id}
    </delete>
    <delete id="deleteScOpcConfByIds" parameterType="String">
        delete from sc_opc_conf where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
billion-ui/src/api/main/sc/opcConf.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
import request from '@/utils/request'
// æŸ¥è¯¢OPC交互配置列表
export function listOpcConf(query) {
  return request({
    url: '/sc/opcConf/list',
    method: 'get',
    params: query
  })
}
// æŸ¥è¯¢OPC交互配置详细
export function getOpcConf(id) {
  return request({
    url: '/sc/opcConf/' + id,
    method: 'get'
  })
}
// æ–°å¢žOPC交互配置
export function addOpcConf(data) {
  return request({
    url: '/sc/opcConf',
    method: 'post',
    data: data
  })
}
// ä¿®æ”¹OPC交互配置
export function updateOpcConf(data) {
  return request({
    url: '/sc/opcConf',
    method: 'put',
    data: data
  })
}
// åˆ é™¤OPC交互配置
export function delOpcConf(id) {
  return request({
    url: '/sc/opcConf/' + id,
    method: 'delete'
  })
}
billion-ui/src/views/main/sc/opcConf/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,279 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="工位名称" prop="locationName">
        <el-input
          v-model="queryParams.locationName"
          placeholder="请输入工位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="地址" prop="node">
        <el-input
          v-model="queryParams.node"
          placeholder="请输入地址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['sc:opcConf:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['sc:opcConf:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['sc:opcConf:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['sc:opcConf:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="opcConfList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键id" align="center" prop="id" />
      <el-table-column label="工位编码" align="center" prop="locationCode" />
      <el-table-column label="工位名称" align="center" prop="locationName" />
      <el-table-column label="地址" align="center" prop="node" />
      <el-table-column label="采集类型" align="center" prop="type" />
      <el-table-column label="是否订阅" align="center" prop="subscribe" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['sc:opcConf:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['sc:opcConf:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- æ·»åŠ æˆ–修改OPC交互配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="工位编码" prop="locationCode">
          <el-input v-model="form.locationCode" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="工位名称" prop="locationName">
          <el-input v-model="form.locationName" placeholder="请输入工位名称" />
        </el-form-item>
        <el-form-item label="地址" prop="node">
          <el-input v-model="form.node" placeholder="请输入地址" />
        </el-form-item>
<!--        <el-form-item label="删除标志" prop="delFlag">-->
<!--          <el-input v-model="form.delFlag" placeholder="请输入删除标志" />-->
<!--        </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">ç¡® å®š</el-button>
        <el-button @click="cancel">取 æ¶ˆ</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listOpcConf, getOpcConf, delOpcConf, addOpcConf, updateOpcConf } from "@/api/main/sc/opcConf";
export default {
  name: "OpcConf",
  data() {
    return {
      // é®ç½©å±‚
      loading: true,
      // é€‰ä¸­æ•°ç»„
      ids: [],
      // éžå•ä¸ªç¦ç”¨
      single: true,
      // éžå¤šä¸ªç¦ç”¨
      multiple: true,
      // æ˜¾ç¤ºæœç´¢æ¡ä»¶
      showSearch: true,
      // æ€»æ¡æ•°
      total: 0,
      // OPC交互配置表格数据
      opcConfList: [],
      // å¼¹å‡ºå±‚标题
      title: "",
      // æ˜¯å¦æ˜¾ç¤ºå¼¹å‡ºå±‚
      open: false,
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        locationCode: null,
        locationName: null,
        node: null,
        type: null,
        subscribe: null,
      },
      // è¡¨å•å‚æ•°
      form: {},
      // è¡¨å•æ ¡éªŒ
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** æŸ¥è¯¢OPC交互配置列表 */
    getList() {
      this.loading = true;
      listOpcConf(this.queryParams).then(response => {
        this.opcConfList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // å–消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // è¡¨å•é‡ç½®
    reset() {
      this.form = {
        id: null,
        locationCode: null,
        locationName: null,
        node: null,
        type: null,
        subscribe: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** æœç´¢æŒ‰é’®æ“ä½œ */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** é‡ç½®æŒ‰é’®æ“ä½œ */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // å¤šé€‰æ¡†é€‰ä¸­æ•°æ®
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** æ–°å¢žæŒ‰é’®æ“ä½œ */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加OPC交互配置";
    },
    /** ä¿®æ”¹æŒ‰é’®æ“ä½œ */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getOpcConf(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改OPC交互配置";
      });
    },
    /** æäº¤æŒ‰é’® */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateOpcConf(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOpcConf(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** åˆ é™¤æŒ‰é’®æ“ä½œ */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除OPC交互配置编号为"' + ids + '"的数据项?').then(function() {
        return delOpcConf(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** å¯¼å‡ºæŒ‰é’®æ“ä½œ */
    handleExport() {
      this.download('sc/opcConf/export', {
        ...this.queryParams
      }, `opcConf_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>