新增扎线设备接口集成

This commit is contained in:
zhoumingxiu 2024-01-02 17:18:19 +08:00
parent 41ed73cbd8
commit 1f3812d787
8 changed files with 1110 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.god.web.controller.tiewire;
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.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.god.tiewire.domain.TiewireInterfaceInfo;
import com.god.tiewire.service.ITiewireInterfaceInfoService;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 接口集成Controller
*
* @author god
* @date 2024-01-02
*/
@RestController
@RequestMapping("/tiewire/interface")
public class TiewireInterfaceInfoController extends BaseController
{
@Autowired
private ITiewireInterfaceInfoService tiewireInterfaceInfoService;
/**
* 查询接口集成列表
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:list')")
@GetMapping("/list")
public TableDataInfo list(TiewireInterfaceInfo tiewireInterfaceInfo)
{
startPage();
List<TiewireInterfaceInfo> list = tiewireInterfaceInfoService.selectTiewireInterfaceInfoList(tiewireInterfaceInfo);
return getDataTable(list);
}
/**
* 导出接口集成列表
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:export')")
@Log(title = "接口集成", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TiewireInterfaceInfo tiewireInterfaceInfo)
{
List<TiewireInterfaceInfo> list = tiewireInterfaceInfoService.selectTiewireInterfaceInfoList(tiewireInterfaceInfo);
ExcelUtil<TiewireInterfaceInfo> util = new ExcelUtil<TiewireInterfaceInfo>(TiewireInterfaceInfo.class);
util.exportExcel(response, list, "接口集成数据");
}
/**
* 获取接口集成详细信息
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(tiewireInterfaceInfoService.selectTiewireInterfaceInfoById(id));
}
/**
* 新增接口集成
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:add')")
@Log(title = "接口集成", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TiewireInterfaceInfo tiewireInterfaceInfo)
{
return toAjax(tiewireInterfaceInfoService.insertTiewireInterfaceInfo(tiewireInterfaceInfo));
}
/**
* 修改接口集成
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:edit')")
@Log(title = "接口集成", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TiewireInterfaceInfo tiewireInterfaceInfo)
{
return toAjax(tiewireInterfaceInfoService.updateTiewireInterfaceInfo(tiewireInterfaceInfo));
}
/**
* 删除接口集成
*/
@PreAuthorize("@ss.hasPermi('tiewire:interface:remove')")
@Log(title = "接口集成", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(tiewireInterfaceInfoService.deleteTiewireInterfaceInfoByIds(ids));
}
}

View File

@ -0,0 +1,196 @@
package com.god.tiewire.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 接口集成对象 tiewire_interface_info
*
* @author god
* @date 2024-01-02
*/
public class TiewireInterfaceInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private String id;
/** 接口id */
@Excel(name = "接口id")
private String interfaceCode;
/** 接口名称 */
@Excel(name = "接口名称")
private String interfaceName;
/** 协议类型 */
@Excel(name = "协议类型")
private String protocolType;
/** 设备品牌 */
@Excel(name = "设备品牌")
private String deviceBrand;
/** 轧辊类型 */
@Excel(name = "轧辊类型")
private String productType;
/** 接口类型 */
@Excel(name = "接口类型")
private String interfaceType;
/** 是否启用 */
@Excel(name = "是否启用")
private String callType;
/** 接口地址 */
@Excel(name = "接口地址")
private String address;
/** 跳转地址 */
@Excel(name = "跳转地址")
private String token;
/** 参数值 */
@Excel(name = "参数值")
private String paramValue;
/** 数据类型 */
@Excel(name = "数据类型")
private String dataType;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setInterfaceCode(String interfaceCode)
{
this.interfaceCode = interfaceCode;
}
public String getInterfaceCode()
{
return interfaceCode;
}
public void setInterfaceName(String interfaceName)
{
this.interfaceName = interfaceName;
}
public String getInterfaceName()
{
return interfaceName;
}
public void setProtocolType(String protocolType)
{
this.protocolType = protocolType;
}
public String getProtocolType()
{
return protocolType;
}
public void setDeviceBrand(String deviceBrand)
{
this.deviceBrand = deviceBrand;
}
public String getDeviceBrand()
{
return deviceBrand;
}
public void setProductType(String productType)
{
this.productType = productType;
}
public String getProductType()
{
return productType;
}
public void setInterfaceType(String interfaceType)
{
this.interfaceType = interfaceType;
}
public String getInterfaceType()
{
return interfaceType;
}
public void setCallType(String callType)
{
this.callType = callType;
}
public String getCallType()
{
return callType;
}
public void setAddress(String address)
{
this.address = address;
}
public String getAddress()
{
return address;
}
public void setToken(String token)
{
this.token = token;
}
public String getToken()
{
return token;
}
public void setParamValue(String paramValue)
{
this.paramValue = paramValue;
}
public String getParamValue()
{
return paramValue;
}
public void setDataType(String dataType)
{
this.dataType = dataType;
}
public String getDataType()
{
return dataType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("interfaceCode", getInterfaceCode())
.append("interfaceName", getInterfaceName())
.append("protocolType", getProtocolType())
.append("deviceBrand", getDeviceBrand())
.append("productType", getProductType())
.append("interfaceType", getInterfaceType())
.append("callType", getCallType())
.append("address", getAddress())
.append("token", getToken())
.append("paramValue", getParamValue())
.append("remark", getRemark())
.append("dataType", getDataType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.god.tiewire.mapper;
import java.util.List;
import com.god.tiewire.domain.TiewireInterfaceInfo;
/**
* 接口集成Mapper接口
*
* @author god
* @date 2024-01-02
*/
public interface TiewireInterfaceInfoMapper
{
/**
* 查询接口集成
*
* @param id 接口集成主键
* @return 接口集成
*/
public TiewireInterfaceInfo selectTiewireInterfaceInfoById(String id);
/**
* 查询接口集成列表
*
* @param tiewireInterfaceInfo 接口集成
* @return 接口集成集合
*/
public List<TiewireInterfaceInfo> selectTiewireInterfaceInfoList(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 新增接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
public int insertTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 修改接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
public int updateTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 删除接口集成
*
* @param id 接口集成主键
* @return 结果
*/
public int deleteTiewireInterfaceInfoById(String id);
/**
* 批量删除接口集成
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTiewireInterfaceInfoByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.tiewire.service;
import java.util.List;
import com.god.tiewire.domain.TiewireInterfaceInfo;
/**
* 接口集成Service接口
*
* @author god
* @date 2024-01-02
*/
public interface ITiewireInterfaceInfoService
{
/**
* 查询接口集成
*
* @param id 接口集成主键
* @return 接口集成
*/
public TiewireInterfaceInfo selectTiewireInterfaceInfoById(String id);
/**
* 查询接口集成列表
*
* @param tiewireInterfaceInfo 接口集成
* @return 接口集成集合
*/
public List<TiewireInterfaceInfo> selectTiewireInterfaceInfoList(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 新增接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
public int insertTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 修改接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
public int updateTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo);
/**
* 批量删除接口集成
*
* @param ids 需要删除的接口集成主键集合
* @return 结果
*/
public int deleteTiewireInterfaceInfoByIds(String[] ids);
/**
* 删除接口集成信息
*
* @param id 接口集成主键
* @return 结果
*/
public int deleteTiewireInterfaceInfoById(String id);
}

View File

@ -0,0 +1,98 @@
package com.god.tiewire.service.impl;
import java.util.List;
import com.god.common.utils.DateUtils;
import com.god.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.god.tiewire.mapper.TiewireInterfaceInfoMapper;
import com.god.tiewire.domain.TiewireInterfaceInfo;
import com.god.tiewire.service.ITiewireInterfaceInfoService;
/**
* 接口集成Service业务层处理
*
* @author god
* @date 2024-01-02
*/
@Service
public class TiewireInterfaceInfoServiceImpl implements ITiewireInterfaceInfoService
{
@Autowired
private TiewireInterfaceInfoMapper tiewireInterfaceInfoMapper;
/**
* 查询接口集成
*
* @param id 接口集成主键
* @return 接口集成
*/
@Override
public TiewireInterfaceInfo selectTiewireInterfaceInfoById(String id)
{
return tiewireInterfaceInfoMapper.selectTiewireInterfaceInfoById(id);
}
/**
* 查询接口集成列表
*
* @param tiewireInterfaceInfo 接口集成
* @return 接口集成
*/
@Override
public List<TiewireInterfaceInfo> selectTiewireInterfaceInfoList(TiewireInterfaceInfo tiewireInterfaceInfo)
{
return tiewireInterfaceInfoMapper.selectTiewireInterfaceInfoList(tiewireInterfaceInfo);
}
/**
* 新增接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
@Override
public int insertTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo)
{
tiewireInterfaceInfo.setId(IdUtils.fastUUID());
tiewireInterfaceInfo.setCreateTime(DateUtils.getNowDate());
return tiewireInterfaceInfoMapper.insertTiewireInterfaceInfo(tiewireInterfaceInfo);
}
/**
* 修改接口集成
*
* @param tiewireInterfaceInfo 接口集成
* @return 结果
*/
@Override
public int updateTiewireInterfaceInfo(TiewireInterfaceInfo tiewireInterfaceInfo)
{
tiewireInterfaceInfo.setUpdateTime(DateUtils.getNowDate());
return tiewireInterfaceInfoMapper.updateTiewireInterfaceInfo(tiewireInterfaceInfo);
}
/**
* 批量删除接口集成
*
* @param ids 需要删除的接口集成主键
* @return 结果
*/
@Override
public int deleteTiewireInterfaceInfoByIds(String[] ids)
{
return tiewireInterfaceInfoMapper.deleteTiewireInterfaceInfoByIds(ids);
}
/**
* 删除接口集成信息
*
* @param id 接口集成主键
* @return 结果
*/
@Override
public int deleteTiewireInterfaceInfoById(String id)
{
return tiewireInterfaceInfoMapper.deleteTiewireInterfaceInfoById(id);
}
}

View File

@ -0,0 +1,132 @@
<?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.god.tiewire.mapper.TiewireInterfaceInfoMapper">
<resultMap type="TiewireInterfaceInfo" id="TiewireInterfaceInfoResult">
<result property="id" column="id"/>
<result property="interfaceCode" column="interface_code"/>
<result property="interfaceName" column="interface_name"/>
<result property="protocolType" column="protocol_type"/>
<result property="deviceBrand" column="device_brand"/>
<result property="productType" column="product_type"/>
<result property="interfaceType" column="interface_type"/>
<result property="callType" column="call_type"/>
<result property="address" column="address"/>
<result property="token" column="token"/>
<result property="paramValue" column="param_value"/>
<result property="remark" column="remark"/>
<result property="dataType" column="data_type"/>
<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="selectTiewireInterfaceInfoVo">
select id, interface_code, interface_name, protocol_type, device_brand, product_type, interface_type, call_type, address, token, param_value, remark, data_type, create_by, create_time, update_by, update_time from tiewire_interface_info
</sql>
<select id="selectTiewireInterfaceInfoList" parameterType="TiewireInterfaceInfo"
resultMap="TiewireInterfaceInfoResult">
<include refid="selectTiewireInterfaceInfoVo"/>
<where>
<if test="interfaceCode != null and interfaceCode != ''">and interface_code = #{interfaceCode}</if>
<if test="interfaceName != null and interfaceName != ''">and interface_name like concat('%',
#{interfaceName}, '%')
</if>
<if test="protocolType != null and protocolType != ''">and protocol_type = #{protocolType}</if>
<if test="deviceBrand != null and deviceBrand != ''">and device_brand = #{deviceBrand}</if>
<if test="productType != null and productType != ''">and product_type = #{productType}</if>
<if test="interfaceType != null and interfaceType != ''">and interface_type = #{interfaceType}</if>
<if test="callType != null and callType != ''">and call_type = #{callType}</if>
<if test="address != null and address != ''">and address = #{address}</if>
<if test="token != null and token != ''">and token = #{token}</if>
<if test="paramValue != null and paramValue != ''">and param_value = #{paramValue}</if>
<if test="dataType != null and dataType != ''">and data_type = #{dataType}</if>
</where>
order by interface_code
</select>
<select id="selectTiewireInterfaceInfoById" parameterType="String" resultMap="TiewireInterfaceInfoResult">
<include refid="selectTiewireInterfaceInfoVo"/>
where id = #{id}
</select>
<insert id="insertTiewireInterfaceInfo" parameterType="TiewireInterfaceInfo">
insert into tiewire_interface_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="interfaceCode != null">interface_code,</if>
<if test="interfaceName != null">interface_name,</if>
<if test="protocolType != null">protocol_type,</if>
<if test="deviceBrand != null">device_brand,</if>
<if test="productType != null">product_type,</if>
<if test="interfaceType != null">interface_type,</if>
<if test="callType != null">call_type,</if>
<if test="address != null">address,</if>
<if test="token != null">token,</if>
<if test="paramValue != null">param_value,</if>
<if test="remark != null">remark,</if>
<if test="dataType != null">data_type,</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="id != null">#{id},</if>
<if test="interfaceCode != null">#{interfaceCode},</if>
<if test="interfaceName != null">#{interfaceName},</if>
<if test="protocolType != null">#{protocolType},</if>
<if test="deviceBrand != null">#{deviceBrand},</if>
<if test="productType != null">#{productType},</if>
<if test="interfaceType != null">#{interfaceType},</if>
<if test="callType != null">#{callType},</if>
<if test="address != null">#{address},</if>
<if test="token != null">#{token},</if>
<if test="paramValue != null">#{paramValue},</if>
<if test="remark != null">#{remark},</if>
<if test="dataType != null">#{dataType},</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="updateTiewireInterfaceInfo" parameterType="TiewireInterfaceInfo">
update tiewire_interface_info
<trim prefix="SET" suffixOverrides=",">
<if test="interfaceCode != null">interface_code = #{interfaceCode},</if>
<if test="interfaceName != null">interface_name = #{interfaceName},</if>
<if test="protocolType != null">protocol_type = #{protocolType},</if>
<if test="deviceBrand != null">device_brand = #{deviceBrand},</if>
<if test="productType != null">product_type = #{productType},</if>
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
<if test="callType != null">call_type = #{callType},</if>
<if test="address != null">address = #{address},</if>
<if test="token != null">token = #{token},</if>
<if test="paramValue != null">param_value = #{paramValue},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="dataType != null">data_type = #{dataType},</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="deleteTiewireInterfaceInfoById" parameterType="String">
delete from tiewire_interface_info where id = #{id}
</delete>
<delete id="deleteTiewireInterfaceInfoByIds" parameterType="String">
delete from tiewire_interface_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询接口集成列表
export function listInterface(query) {
return request({
url: '/tiewire/interface/list',
method: 'get',
params: query
})
}
// 查询接口集成详细
export function getInterface(id) {
return request({
url: '/tiewire/interface/' + id,
method: 'get'
})
}
// 新增接口集成
export function addInterface(data) {
return request({
url: '/tiewire/interface',
method: 'post',
data: data
})
}
// 修改接口集成
export function updateInterface(data) {
return request({
url: '/tiewire/interface',
method: 'put',
data: data
})
}
// 删除接口集成
export function delInterface(id) {
return request({
url: '/tiewire/interface/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,414 @@
<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="interfaceCode">
<el-input
v-model="queryParams.interfaceCode"
placeholder="请输入接口编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="接口名称" prop="interfaceName">
<el-input
v-model="queryParams.interfaceName"
placeholder="请输入接口名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="轧辊类型" prop="productType">
<el-select v-model="queryParams.productType" placeholder="请选择轧辊类型" clearable>
<el-option
v-for="dict in dict.type.tiewire_device_line_name"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="接口类型" prop="interfaceType">
<el-select v-model="queryParams.interfaceType" placeholder="请选择接口类型" clearable>
<el-option
v-for="dict in dict.type.tiewire_device_line_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="['tiewire:interface: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="['tiewire:interface: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="['tiewire:interface: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="['tiewire:interface:export']"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="interfaceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="接口编号" align="center" prop="interfaceCode"/>
<el-table-column label="接口名称" align="center" prop="interfaceName" width="180"/>
<el-table-column label="协议类型" align="center" prop="protocolType">
<template slot-scope="scope">
<dict-tag :options="dict.type.cqyg_protocol_docking_type" :value="scope.row.protocolType"/>
</template>
</el-table-column>
<el-table-column label="设备品牌" align="center" prop="deviceBrand"/>
<el-table-column label="轧辊类型" align="center" prop="productType">
<template slot-scope="scope">
<dict-tag :options="dict.type.tiewire_device_line_name" :value="scope.row.productType"/>
</template>
</el-table-column>
<el-table-column label="接口类型" align="center" prop="interfaceType">
<template slot-scope="scope">
<dict-tag :options="dict.type.tiewire_device_line_type" :value="scope.row.interfaceType"/>
</template>
</el-table-column>
<el-table-column label="是否启用" align="center" prop="callType">
<template slot-scope="scope">
<el-switch
v-model="scope.row.callType"
active-value="是"
inactive-value="否"
@change="handleStatusChange(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="接口地址" align="center" prop="address" width="150"/>
<!--<el-table-column label="跳转地址" align="center" prop="token"/>
<el-table-column label="参数值" align="center" prop="paramValue"/>
<el-table-column label="备注" align="center" prop="remark"/>-->
<el-table-column label="接口状态" align="center" prop="dataType"/>
<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="['tiewire:interface:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['tiewire:interface: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"
/>
<!-- 添加或修改接口集成对话框 -->
<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="interfaceCode">
<el-input v-model="form.interfaceCode" placeholder="请输入接口编号"/>
</el-form-item>
<el-form-item label="接口名称" prop="interfaceName">
<el-input v-model="form.interfaceName" placeholder="请输入接口名称"/>
</el-form-item>
<el-form-item label="协议类型" prop="protocolType">
<el-select v-model="form.protocolType" placeholder="请选择协议类型">
<el-option
v-for="dict in dict.type.cqyg_protocol_docking_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备品牌" prop="deviceBrand">
<el-input v-model="form.deviceBrand" placeholder="请输入设备品牌"/>
</el-form-item>
<el-form-item label="轧辊类型" prop="productType">
<el-select v-model="form.productType" placeholder="请选择轧辊类型">
<el-option
v-for="dict in dict.type.tiewire_device_line_name"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="接口类型" prop="interfaceType">
<el-select v-model="form.interfaceType" placeholder="请选择接口类型">
<el-option
v-for="dict in dict.type.tiewire_device_line_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="是否启用" prop="callType">
<template>
<el-radio v-model="form.callType" label="是"></el-radio>
<el-radio v-model="form.callType" label="否"></el-radio>
</template>
</el-form-item>
<el-form-item label="接口地址" prop="address">
<el-input v-model="form.address" placeholder="请输入接口地址"/>
</el-form-item>
<el-form-item label="接口状态" prop="dataType">
<el-input v-model="form.dataType" placeholder="请输入接口状态"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"/>
</el-form-item>
<el-form-item label="跳转地址" prop="token">
<el-input v-model="form.token" placeholder="请输入跳转地址"/>
</el-form-item>
<el-form-item label="参数值" prop="paramValue">
<el-input v-model="form.paramValue" 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 {listInterface, getInterface, delInterface, addInterface, updateInterface} from "@/api/tiewire/interface";
import {updateDocking} from "@/api/machinery/docking";
export default {
name: "Interface",
dicts: ['tiewire_device_line_type', 'cqyg_protocol_docking_type', 'tiewire_device_line_name'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
interfaceList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
interfaceCode: null,
interfaceName: null,
protocolType: null,
deviceBrand: null,
productType: null,
interfaceType: null,
callType: null,
address: null,
token: null,
paramValue: null,
dataType: null,
},
//
form: {},
//
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询接口集成列表 */
getList() {
this.loading = true;
listInterface(this.queryParams).then(response => {
this.interfaceList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
interfaceCode: null,
interfaceName: null,
protocolType: 'HTTP',
deviceBrand: '森吉米尔ZR21A',
productType: null,
interfaceType: null,
callType: '是',
address: null,
token: null,
paramValue: null,
remark: null,
dataType: '正常',
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 = "添加接口集成";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInterface(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改接口集成";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInterface(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInterface(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除接口集成编号为"' + ids + '"的数据项?').then(function () {
return delInterface(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('tiewire/interface/export', {
...this.queryParams
}, `interface_${new Date().getTime()}.xlsx`)
},
//
handleStatusChange(row) {
let text = row.callType === "开启" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""' + row.interfaceName + '"接口吗?').then(function () {
let param = {};
param.id = row.id;
param.callType = row.callType;
if (param.id) {
updateDocking(param).then(response => {
this.$modal.msgSuccess("更新状态成功");
});
}
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function () {
row.callType = row.callType === "开启" ? "启用" : "停用";
});
},
}
};
</script>