change - add工厂信息

1.2.6
yinq 10 months ago
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,98 @@
package com.hw.mes.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_base_factory_info
*
* @author Yinq
* @date 2024-01-23
*/
public class MesBaseFactoryInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long factoryId;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyName;
/** 工厂编号 */
@Excel(name = "工厂编号")
private String factoryCode;
/** 工厂名称 */
@Excel(name = "工厂名称")
private String factoryName;
/** 工厂状态1-启用0-停用 */
@Excel(name = "工厂状态1-启用0-停用")
private String factoryStatus;
public void setFactoryId(Long factoryId)
{
this.factoryId = factoryId;
}
public Long getFactoryId()
{
return factoryId;
}
public void setCompanyName(String companyName)
{
this.companyName = companyName;
}
public String getCompanyName()
{
return companyName;
}
public void setFactoryCode(String factoryCode)
{
this.factoryCode = factoryCode;
}
public String getFactoryCode()
{
return factoryCode;
}
public void setFactoryName(String factoryName)
{
this.factoryName = factoryName;
}
public String getFactoryName()
{
return factoryName;
}
public void setFactoryStatus(String factoryStatus)
{
this.factoryStatus = factoryStatus;
}
public String getFactoryStatus()
{
return factoryStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("factoryId", getFactoryId())
.append("companyName", getCompanyName())
.append("factoryCode", getFactoryCode())
.append("factoryName", getFactoryName())
.append("factoryStatus", getFactoryStatus())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -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…
Cancel
Save