change - add工厂信息
parent
6544f3b74d
commit
2020b03be6
@ -0,0 +1,109 @@
|
||||
package com.hw.mes.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.hw.common.security.utils.SecurityUtils;
|
||||
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.hw.common.log.annotation.Log;
|
||||
import com.hw.common.log.enums.BusinessType;
|
||||
import com.hw.common.security.annotation.RequiresPermissions;
|
||||
import com.hw.mes.domain.MesBaseFactoryInfo;
|
||||
import com.hw.mes.service.IMesBaseFactoryInfoService;
|
||||
import com.hw.common.core.web.controller.BaseController;
|
||||
import com.hw.common.core.web.domain.AjaxResult;
|
||||
import com.hw.common.core.utils.poi.ExcelUtil;
|
||||
import com.hw.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-01-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/baseFactoryInfo")
|
||||
public class MesBaseFactoryInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IMesBaseFactoryInfoService mesBaseFactoryInfoService;
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
startPage();
|
||||
List<MesBaseFactoryInfo> list = mesBaseFactoryInfoService.selectMesBaseFactoryInfoList(mesBaseFactoryInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工厂信息列表
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:export")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
List<MesBaseFactoryInfo> list = mesBaseFactoryInfoService.selectMesBaseFactoryInfoList(mesBaseFactoryInfo);
|
||||
ExcelUtil<MesBaseFactoryInfo> util = new ExcelUtil<MesBaseFactoryInfo>(MesBaseFactoryInfo.class);
|
||||
util.exportExcel(response, list, "工厂信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工厂信息详细信息
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:query")
|
||||
@GetMapping(value = "/{factoryId}")
|
||||
public AjaxResult getInfo(@PathVariable("factoryId") Long factoryId)
|
||||
{
|
||||
return success(mesBaseFactoryInfoService.selectMesBaseFactoryInfoByFactoryId(factoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:add")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
mesBaseFactoryInfo.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
return toAjax(mesBaseFactoryInfoService.insertMesBaseFactoryInfo(mesBaseFactoryInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:edit")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
mesBaseFactoryInfo.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
return toAjax(mesBaseFactoryInfoService.updateMesBaseFactoryInfo(mesBaseFactoryInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工厂信息
|
||||
*/
|
||||
@RequiresPermissions("mes:baseFactoryInfo:remove")
|
||||
@Log(title = "工厂信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{factoryIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] factoryIds)
|
||||
{
|
||||
return toAjax(mesBaseFactoryInfoService.deleteMesBaseFactoryInfoByFactoryIds(factoryIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.hw.mes.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.mes.domain.MesBaseFactoryInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-01-23
|
||||
*/
|
||||
public interface MesBaseFactoryInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
public MesBaseFactoryInfo selectMesBaseFactoryInfoByFactoryId(Long factoryId);
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 工厂信息集合
|
||||
*/
|
||||
public List<MesBaseFactoryInfo> selectMesBaseFactoryInfoList(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 删除工厂信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseFactoryInfoByFactoryId(Long factoryId);
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param factoryIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseFactoryInfoByFactoryIds(Long[] factoryIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.hw.mes.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.mes.domain.MesBaseFactoryInfo;
|
||||
|
||||
/**
|
||||
* 工厂信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-01-23
|
||||
*/
|
||||
public interface IMesBaseFactoryInfoService
|
||||
{
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
public MesBaseFactoryInfo selectMesBaseFactoryInfoByFactoryId(Long factoryId);
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 工厂信息集合
|
||||
*/
|
||||
public List<MesBaseFactoryInfo> selectMesBaseFactoryInfoList(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo);
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param factoryIds 需要删除的工厂信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseFactoryInfoByFactoryIds(Long[] factoryIds);
|
||||
|
||||
/**
|
||||
* 删除工厂信息信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMesBaseFactoryInfoByFactoryId(Long factoryId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.hw.mes.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.hw.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hw.mes.mapper.MesBaseFactoryInfoMapper;
|
||||
import com.hw.mes.domain.MesBaseFactoryInfo;
|
||||
import com.hw.mes.service.IMesBaseFactoryInfoService;
|
||||
|
||||
/**
|
||||
* 工厂信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2024-01-23
|
||||
*/
|
||||
@Service
|
||||
public class MesBaseFactoryInfoServiceImpl implements IMesBaseFactoryInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MesBaseFactoryInfoMapper mesBaseFactoryInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询工厂信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 工厂信息
|
||||
*/
|
||||
@Override
|
||||
public MesBaseFactoryInfo selectMesBaseFactoryInfoByFactoryId(Long factoryId)
|
||||
{
|
||||
return mesBaseFactoryInfoMapper.selectMesBaseFactoryInfoByFactoryId(factoryId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工厂信息列表
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 工厂信息
|
||||
*/
|
||||
@Override
|
||||
public List<MesBaseFactoryInfo> selectMesBaseFactoryInfoList(MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
return mesBaseFactoryInfoMapper.selectMesBaseFactoryInfoList(mesBaseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
mesBaseFactoryInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mesBaseFactoryInfoMapper.insertMesBaseFactoryInfo(mesBaseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工厂信息
|
||||
*
|
||||
* @param mesBaseFactoryInfo 工厂信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMesBaseFactoryInfo(MesBaseFactoryInfo mesBaseFactoryInfo)
|
||||
{
|
||||
mesBaseFactoryInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mesBaseFactoryInfoMapper.updateMesBaseFactoryInfo(mesBaseFactoryInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除工厂信息
|
||||
*
|
||||
* @param factoryIds 需要删除的工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMesBaseFactoryInfoByFactoryIds(Long[] factoryIds)
|
||||
{
|
||||
return mesBaseFactoryInfoMapper.deleteMesBaseFactoryInfoByFactoryIds(factoryIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工厂信息信息
|
||||
*
|
||||
* @param factoryId 工厂信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMesBaseFactoryInfoByFactoryId(Long factoryId)
|
||||
{
|
||||
return mesBaseFactoryInfoMapper.deleteMesBaseFactoryInfoByFactoryId(factoryId);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<?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.hw.mes.mapper.MesBaseFactoryInfoMapper">
|
||||
|
||||
<resultMap type="MesBaseFactoryInfo" id="MesBaseFactoryInfoResult">
|
||||
<result property="factoryId" column="factory_id" />
|
||||
<result property="companyName" column="company_name" />
|
||||
<result property="factoryCode" column="factory_code" />
|
||||
<result property="factoryName" column="factory_name" />
|
||||
<result property="factoryStatus" column="factory_status" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="selectMesBaseFactoryInfoVo">
|
||||
select factory_id, company_name, factory_code, factory_name, factory_status, remark, create_by, create_time, update_by, update_time from mes_base_factory_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMesBaseFactoryInfoList" parameterType="MesBaseFactoryInfo" resultMap="MesBaseFactoryInfoResult">
|
||||
<include refid="selectMesBaseFactoryInfoVo"/>
|
||||
<where>
|
||||
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
||||
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
||||
<if test="factoryName != null and factoryName != ''"> and factory_name like concat('%', #{factoryName}, '%')</if>
|
||||
<if test="factoryStatus != null and factoryStatus != ''"> and factory_status = #{factoryStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMesBaseFactoryInfoByFactoryId" parameterType="Long" resultMap="MesBaseFactoryInfoResult">
|
||||
<include refid="selectMesBaseFactoryInfoVo"/>
|
||||
where factory_id = #{factoryId}
|
||||
</select>
|
||||
|
||||
<insert id="insertMesBaseFactoryInfo" parameterType="MesBaseFactoryInfo" useGeneratedKeys="true" keyProperty="factoryId">
|
||||
insert into mes_base_factory_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="companyName != null">company_name,</if>
|
||||
<if test="factoryCode != null">factory_code,</if>
|
||||
<if test="factoryName != null and factoryName != ''">factory_name,</if>
|
||||
<if test="factoryStatus != null and factoryStatus != ''">factory_status,</if>
|
||||
<if test="remark != null">remark,</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="companyName != null">#{companyName},</if>
|
||||
<if test="factoryCode != null">#{factoryCode},</if>
|
||||
<if test="factoryName != null and factoryName != ''">#{factoryName},</if>
|
||||
<if test="factoryStatus != null and factoryStatus != ''">#{factoryStatus},</if>
|
||||
<if test="remark != null">#{remark},</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="updateMesBaseFactoryInfo" parameterType="MesBaseFactoryInfo">
|
||||
update mes_base_factory_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="companyName != null">company_name = #{companyName},</if>
|
||||
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
|
||||
<if test="factoryName != null and factoryName != ''">factory_name = #{factoryName},</if>
|
||||
<if test="factoryStatus != null and factoryStatus != ''">factory_status = #{factoryStatus},</if>
|
||||
<if test="remark != null">remark = #{remark},</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 factory_id = #{factoryId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMesBaseFactoryInfoByFactoryId" parameterType="Long">
|
||||
delete from mes_base_factory_info where factory_id = #{factoryId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMesBaseFactoryInfoByFactoryIds" parameterType="String">
|
||||
delete from mes_base_factory_info where factory_id in
|
||||
<foreach item="factoryId" collection="array" open="(" separator="," close=")">
|
||||
#{factoryId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工厂信息列表
|
||||
export function listBaseFactoryInfo(query) {
|
||||
return request({
|
||||
url: '/mes/baseFactoryInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工厂信息详细
|
||||
export function getBaseFactoryInfo(factoryId) {
|
||||
return request({
|
||||
url: '/mes/baseFactoryInfo/' + factoryId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工厂信息
|
||||
export function addBaseFactoryInfo(data) {
|
||||
return request({
|
||||
url: '/mes/baseFactoryInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工厂信息
|
||||
export function updateBaseFactoryInfo(data) {
|
||||
return request({
|
||||
url: '/mes/baseFactoryInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工厂信息
|
||||
export function delBaseFactoryInfo(factoryId) {
|
||||
return request({
|
||||
url: '/mes/baseFactoryInfo/' + factoryId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,334 @@
|
||||
<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="factoryCode">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.factoryCode"-->
|
||||
<!-- placeholder="请输入工厂编号"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="工厂名称" prop="factoryName">
|
||||
<el-input
|
||||
v-model="queryParams.factoryName"
|
||||
placeholder="请输入工厂名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂状态" prop="factoryStatus">
|
||||
<el-select v-model="queryParams.factoryStatus" placeholder="请选择工厂状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.factory_status"
|
||||
: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="['mes:baseFactoryInfo: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="['mes:baseFactoryInfo: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="['mes:baseFactoryInfo: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="['mes:baseFactoryInfo:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="baseFactoryInfoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="主键标识" align="center" prop="factoryId" v-if="columns[0].visible"/>
|
||||
<el-table-column label="公司名称" align="center" prop="companyName" v-if="columns[1].visible"/>
|
||||
<el-table-column label="工厂编号" align="center" prop="factoryCode" v-if="columns[2].visible"/>
|
||||
<el-table-column label="工厂名称" align="center" prop="factoryName" v-if="columns[3].visible"/>
|
||||
<el-table-column label="工厂状态" align="center" prop="factoryStatus" v-if="columns[4].visible">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.factory_status" :value="scope.row.factoryStatus"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" v-if="columns[5].visible"/>
|
||||
<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="['mes:baseFactoryInfo:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:baseFactoryInfo: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="companyName">
|
||||
<el-input v-model="form.companyName" placeholder="请输入公司名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂编号" prop="factoryCode">
|
||||
<el-input v-model="form.factoryCode" placeholder="请输入工厂编号"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂名称" prop="factoryName">
|
||||
<el-input v-model="form.factoryName" placeholder="请输入工厂名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工厂状态" prop="factoryStatus">
|
||||
<el-radio-group v-model="form.factoryStatus">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.factory_status"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" 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 {
|
||||
listBaseFactoryInfo,
|
||||
getBaseFactoryInfo,
|
||||
delBaseFactoryInfo,
|
||||
addBaseFactoryInfo,
|
||||
updateBaseFactoryInfo
|
||||
} from "@/api/mes/baseFactoryInfo";
|
||||
|
||||
export default {
|
||||
name: "BaseFactoryInfo",
|
||||
dicts: ['factory_status'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 工厂信息表格数据
|
||||
baseFactoryInfoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
companyName: null,
|
||||
factoryCode: null,
|
||||
factoryName: null,
|
||||
factoryStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
factoryName: [
|
||||
{required: true, message: "工厂名称不能为空", trigger: "blur"}
|
||||
],
|
||||
factoryStatus: [
|
||||
{required: true, message: "工厂状态不能为空", trigger: "change"}
|
||||
],
|
||||
},
|
||||
columns: [
|
||||
{key: 0, label: `主键标识`, visible: false},
|
||||
{key: 1, label: `公司名称`, visible: true},
|
||||
{key: 2, label: `工厂编号`, visible: true},
|
||||
{key: 3, label: `工厂名称`, visible: true},
|
||||
{key: 4, label: `工厂状态`, visible: true},
|
||||
{key: 5, label: `备注`, visible: true},
|
||||
{key: 6, label: `创建人`, visible: true},
|
||||
{key: 7, label: `创建时间`, visible: true},
|
||||
{key: 8, label: `更新人`, visible: true},
|
||||
{key: 9, label: `更新时间`, visible: true},
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询工厂信息列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listBaseFactoryInfo(this.queryParams).then(response => {
|
||||
this.baseFactoryInfoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
factoryId: null,
|
||||
companyName: null,
|
||||
factoryCode: null,
|
||||
factoryName: null,
|
||||
factoryStatus: '1',
|
||||
remark: 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.factoryId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加工厂信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const factoryId = row.factoryId || this.ids
|
||||
getBaseFactoryInfo(factoryId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改工厂信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.factoryId != null) {
|
||||
updateBaseFactoryInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addBaseFactoryInfo(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const factoryIds = row.factoryId || this.ids;
|
||||
this.$modal.confirm('是否确认删除工厂信息编号为"' + factoryIds + '"的数据项?').then(function () {
|
||||
return delBaseFactoryInfo(factoryIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('mes/baseFactoryInfo/export', {
|
||||
...this.queryParams
|
||||
}, `baseFactoryInfo_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue