change - 添加测试页面

master
wenjy 7 months ago
parent 4fc0614ad9
commit bf5cc2784a

@ -0,0 +1,105 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.BaseFactoryInfo;
import com.ruoyi.system.service.IBaseFactoryInfoService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2024-07-01
*/
@RestController
@RequestMapping("/info")
public class BaseFactoryInfoController extends BaseController
{
@Autowired
private IBaseFactoryInfoService baseFactoryInfoService;
/**
*
*/
@RequiresPermissions("system:info:list")
@GetMapping("/list")
public TableDataInfo list(BaseFactoryInfo baseFactoryInfo)
{
startPage();
List<BaseFactoryInfo> list = baseFactoryInfoService.selectBaseFactoryInfoList(baseFactoryInfo);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:info:export")
@Log(title = "工厂信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseFactoryInfo baseFactoryInfo)
{
List<BaseFactoryInfo> list = baseFactoryInfoService.selectBaseFactoryInfoList(baseFactoryInfo);
ExcelUtil<BaseFactoryInfo> util = new ExcelUtil<BaseFactoryInfo>(BaseFactoryInfo.class);
util.exportExcel(response, list, "工厂信息数据");
}
/**
*
*/
@RequiresPermissions("system:info:query")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(baseFactoryInfoService.selectBaseFactoryInfoByObjId(objId));
}
/**
*
*/
@RequiresPermissions("system:info:add")
@Log(title = "工厂信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseFactoryInfo baseFactoryInfo)
{
return toAjax(baseFactoryInfoService.insertBaseFactoryInfo(baseFactoryInfo));
}
/**
*
*/
@RequiresPermissions("system:info:edit")
@Log(title = "工厂信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseFactoryInfo baseFactoryInfo)
{
return toAjax(baseFactoryInfoService.updateBaseFactoryInfo(baseFactoryInfo));
}
/**
*
*/
@RequiresPermissions("system:info:remove")
@Log(title = "工厂信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(baseFactoryInfoService.deleteBaseFactoryInfoByObjIds(objIds));
}
}

@ -0,0 +1,168 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* base_factory_info
*
* @author ruoyi
* @date 2024-07-01
*/
public class BaseFactoryInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 标识 */
private Long objId;
/** 公司名称 */
@Excel(name = "公司名称")
private String companyCode;
/** 工厂编号 */
@Excel(name = "工厂编号")
private String factoryCode;
/** 工厂名称 */
@Excel(name = "工厂名称")
private String factoryName;
/** 工厂状态 */
@Excel(name = "工厂状态")
private Long factoryStatus;
/** 是否标识:1-是0-否 */
@Excel(name = "是否标识:1-是0-否")
private Long isFlag;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
/** 更新人 */
@Excel(name = "更新人")
private String updatedBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedTime;
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setCompanyCode(String companyCode)
{
this.companyCode = companyCode;
}
public String getCompanyCode()
{
return companyCode;
}
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(Long factoryStatus)
{
this.factoryStatus = factoryStatus;
}
public Long getFactoryStatus()
{
return factoryStatus;
}
public void setIsFlag(Long isFlag)
{
this.isFlag = isFlag;
}
public Long getIsFlag()
{
return isFlag;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedTime(Date updatedTime)
{
this.updatedTime = updatedTime;
}
public Date getUpdatedTime()
{
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("companyCode", getCompanyCode())
.append("factoryCode", getFactoryCode())
.append("factoryName", getFactoryName())
.append("factoryStatus", getFactoryStatus())
.append("isFlag", getIsFlag())
.append("remark", getRemark())
.append("createdBy", getCreatedBy())
.append("createdTime", getCreatedTime())
.append("updatedBy", getUpdatedBy())
.append("updatedTime", getUpdatedTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.BaseFactoryInfo;
/**
* Mapper
*
* @author ruoyi
* @date 2024-07-01
*/
public interface BaseFactoryInfoMapper
{
/**
*
*
* @param objId
* @return
*/
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseFactoryInfoByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseFactoryInfoByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.BaseFactoryInfo;
/**
* Service
*
* @author ruoyi
* @date 2024-07-01
*/
public interface IBaseFactoryInfoService
{
/**
*
*
* @param objId
* @return
*/
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param baseFactoryInfo
* @return
*/
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseFactoryInfoByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseFactoryInfoByObjId(Long objId);
}

@ -0,0 +1,101 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BaseFactoryInfoMapper;
import com.ruoyi.system.domain.BaseFactoryInfo;
import com.ruoyi.system.service.IBaseFactoryInfoService;
/**
* Service
*
* @author ruoyi
* @date 2024-07-01
*/
@Service
public class BaseFactoryInfoServiceImpl implements IBaseFactoryInfoService
{
@Autowired
private BaseFactoryInfoMapper baseFactoryInfoMapper;
/**
*
*
* @param objId
* @return
*/
@Override
@DS("#header.poolName")
public BaseFactoryInfo selectBaseFactoryInfoByObjId(Long objId)
{
return baseFactoryInfoMapper.selectBaseFactoryInfoByObjId(objId);
}
/**
*
*
* @param baseFactoryInfo
* @return
*/
@Override
@DS("#header.poolName")
public List<BaseFactoryInfo> selectBaseFactoryInfoList(BaseFactoryInfo baseFactoryInfo)
{
return baseFactoryInfoMapper.selectBaseFactoryInfoList(baseFactoryInfo);
}
/**
*
*
* @param baseFactoryInfo
* @return
*/
@Override
@DS("#header.poolName")
public int insertBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo)
{
return baseFactoryInfoMapper.insertBaseFactoryInfo(baseFactoryInfo);
}
/**
*
*
* @param baseFactoryInfo
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseFactoryInfo(BaseFactoryInfo baseFactoryInfo)
{
return baseFactoryInfoMapper.updateBaseFactoryInfo(baseFactoryInfo);
}
/**
*
*
* @param objIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFactoryInfoByObjIds(Long[] objIds)
{
return baseFactoryInfoMapper.deleteBaseFactoryInfoByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFactoryInfoByObjId(Long objId)
{
return baseFactoryInfoMapper.deleteBaseFactoryInfoByObjId(objId);
}
}

@ -0,0 +1,100 @@
<?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.ruoyi.system.mapper.BaseFactoryInfoMapper">
<resultMap type="BaseFactoryInfo" id="BaseFactoryInfoResult">
<result property="objId" column="obj_id" />
<result property="companyCode" column="company_code" />
<result property="factoryCode" column="factory_code" />
<result property="factoryName" column="factory_name" />
<result property="factoryStatus" column="factory_status" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectBaseFactoryInfoVo">
select obj_id, company_code, factory_code, factory_name, factory_status, is_flag, remark, created_by, created_time, updated_by, updated_time from base_factory_info
</sql>
<select id="selectBaseFactoryInfoList" parameterType="BaseFactoryInfo" resultMap="BaseFactoryInfoResult">
<include refid="selectBaseFactoryInfoVo"/>
<where>
<if test="companyCode != null and companyCode != ''"> and company_code = #{companyCode}</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 factory_status = #{factoryStatus}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectBaseFactoryInfoByObjId" parameterType="Long" resultMap="BaseFactoryInfoResult">
<include refid="selectBaseFactoryInfoVo"/>
where obj_id = #{objId}
</select>
<insert id="insertBaseFactoryInfo" parameterType="BaseFactoryInfo" useGeneratedKeys="true" keyProperty="objId">
insert into base_factory_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyCode != null">company_code,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="factoryName != null">factory_name,</if>
<if test="factoryStatus != null">factory_status,</if>
<if test="isFlag != null">is_flag,</if>
<if test="remark != null">remark,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyCode != null">#{companyCode},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="factoryName != null">#{factoryName},</if>
<if test="factoryStatus != null">#{factoryStatus},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateBaseFactoryInfo" parameterType="BaseFactoryInfo">
update base_factory_info
<trim prefix="SET" suffixOverrides=",">
<if test="companyCode != null">company_code = #{companyCode},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="factoryName != null">factory_name = #{factoryName},</if>
<if test="factoryStatus != null">factory_status = #{factoryStatus},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseFactoryInfoByObjId" parameterType="Long">
delete from base_factory_info where obj_id = #{objId}
</delete>
<delete id="deleteBaseFactoryInfoByObjIds" parameterType="String">
delete from base_factory_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询工厂信息列表
export function listInfo(query) {
return request({
url: '/system/info/list',
method: 'get',
params: query
})
}
// 查询工厂信息详细
export function getInfo(objId) {
return request({
url: '/system/info/' + objId,
method: 'get'
})
}
// 新增工厂信息
export function addInfo(data) {
return request({
url: '/system/info',
method: 'post',
data: data
})
}
// 修改工厂信息
export function updateInfo(data) {
return request({
url: '/system/info',
method: 'put',
data: data
})
}
// 删除工厂信息
export function delInfo(objId) {
return request({
url: '/system/info/' + objId,
method: 'delete'
})
}

@ -0,0 +1,369 @@
<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="companyCode">
<el-input
v-model="queryParams.companyCode"
placeholder="请输入公司名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<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="是否标识:1-是0-否" prop="isFlag">
<el-input
v-model="queryParams.isFlag"
placeholder="请输入是否标识:1-是0-否"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建人" prop="createdBy">
<el-input
v-model="queryParams.createdBy"
placeholder="请输入创建人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="queryParams.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新人" prop="updatedBy">
<el-input
v-model="queryParams.updatedBy"
placeholder="请输入更新人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="更新时间" prop="updatedTime">
<el-date-picker clearable
v-model="queryParams.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</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="['system:info: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="['system:info: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="['system:info: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="['system:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="标识" align="center" prop="objId" />
<el-table-column label="公司名称" align="center" prop="companyCode" />
<el-table-column label="工厂编号" align="center" prop="factoryCode" />
<el-table-column label="工厂名称" align="center" prop="factoryName" />
<el-table-column label="工厂状态" align="center" prop="factoryStatus" />
<el-table-column label="是否标识:1-是0-否" align="center" prop="isFlag" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建人" align="center" prop="createdBy" />
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updatedBy" />
<el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<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="['system:info:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:info: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="companyCode">
<el-input v-model="form.companyCode" 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="是否标识:1-是0-否" prop="isFlag">
<el-input v-model="form.isFlag" placeholder="请输入是否标识:1-是0-否" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="创建人" prop="createdBy">
<el-input v-model="form.createdBy" placeholder="请输入创建人" />
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="form.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新人" prop="updatedBy">
<el-input v-model="form.updatedBy" placeholder="请输入更新人" />
</el-form-item>
<el-form-item label="更新时间" prop="updatedTime">
<el-date-picker clearable
v-model="form.updatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择更新时间">
</el-date-picker>
</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 { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/system/info";
export default {
name: "Info",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
companyCode: null,
factoryCode: null,
factoryName: null,
factoryStatus: null,
isFlag: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询工厂信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
objId: null,
companyCode: null,
factoryCode: null,
factoryName: null,
factoryStatus: null,
isFlag: null,
remark: null,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: 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.objId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工厂信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const objId = row.objId || this.ids
getInfo(objId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工厂信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const objIds = row.objId || this.ids;
this.$modal.confirm('是否确认删除工厂信息编号为"' + objIds + '"的数据项?').then(function() {
return delInfo(objIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save