change - add物料类型信息

1.2.6
yinq 10 months ago
parent 2020b03be6
commit 34b414eeaf

@ -0,0 +1,103 @@
package com.hw.mes.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.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBaseMaterialType;
import com.hw.mes.service.IMesBaseMaterialTypeService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
/**
* Controller
*
* @author Yinq
* @date 2024-01-23
*/
@RestController
@RequestMapping("/baseMaterialType")
public class MesBaseMaterialTypeController extends BaseController
{
@Autowired
private IMesBaseMaterialTypeService mesBaseMaterialTypeService;
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:list")
@GetMapping("/list")
public AjaxResult list(MesBaseMaterialType mesBaseMaterialType)
{
List<MesBaseMaterialType> list = mesBaseMaterialTypeService.selectMesBaseMaterialTypeList(mesBaseMaterialType);
return success(list);
}
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:export")
@Log(title = "物料类型信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesBaseMaterialType mesBaseMaterialType)
{
List<MesBaseMaterialType> list = mesBaseMaterialTypeService.selectMesBaseMaterialTypeList(mesBaseMaterialType);
ExcelUtil<MesBaseMaterialType> util = new ExcelUtil<MesBaseMaterialType>(MesBaseMaterialType.class);
util.exportExcel(response, list, "物料类型信息数据");
}
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:query")
@GetMapping(value = "/{matrialTypeId}")
public AjaxResult getInfo(@PathVariable("matrialTypeId") Long matrialTypeId)
{
return success(mesBaseMaterialTypeService.selectMesBaseMaterialTypeByMatrialTypeId(matrialTypeId));
}
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:add")
@Log(title = "物料类型信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesBaseMaterialType mesBaseMaterialType)
{
return toAjax(mesBaseMaterialTypeService.insertMesBaseMaterialType(mesBaseMaterialType));
}
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:edit")
@Log(title = "物料类型信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesBaseMaterialType mesBaseMaterialType)
{
return toAjax(mesBaseMaterialTypeService.updateMesBaseMaterialType(mesBaseMaterialType));
}
/**
*
*/
@RequiresPermissions("mes:baseMaterialType:remove")
@Log(title = "物料类型信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{matrialTypeIds}")
public AjaxResult remove(@PathVariable Long[] matrialTypeIds)
{
return toAjax(mesBaseMaterialTypeService.deleteMesBaseMaterialTypeByMatrialTypeIds(matrialTypeIds));
}
}

@ -0,0 +1,88 @@
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.TreeEntity;
/**
* mes_base_material_type
*
* @author Yinq
* @date 2024-01-23
*/
public class MesBaseMaterialType extends TreeEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long matrialTypeId;
/**
*
*/
@Excel(name = "类型编号")
private String typeCode;
/**
*
*/
@Excel(name = "类型名称")
private String typeName;
/**
*
*/
@Excel(name = "激活标识")
private String activeFlag;
public void setMatrialTypeId(Long matrialTypeId) {
this.matrialTypeId = matrialTypeId;
}
public Long getMatrialTypeId() {
return matrialTypeId;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getTypeName() {
return typeName;
}
public void setActiveFlag(String activeFlag) {
this.activeFlag = activeFlag;
}
public String getActiveFlag() {
return activeFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("matrialTypeId", getMatrialTypeId())
.append("parentId", getParentId())
.append("typeCode", getTypeCode())
.append("typeName", getTypeName())
.append("activeFlag", getActiveFlag())
.append("ancestors", getAncestors())
.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.MesBaseMaterialType;
/**
* Mapper
*
* @author Yinq
* @date 2024-01-23
*/
public interface MesBaseMaterialTypeMapper
{
/**
*
*
* @param matrialTypeId
* @return
*/
public MesBaseMaterialType selectMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public List<MesBaseMaterialType> selectMesBaseMaterialTypeList(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public int insertMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public int updateMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param matrialTypeId
* @return
*/
public int deleteMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId);
/**
*
*
* @param matrialTypeIds
* @return
*/
public int deleteMesBaseMaterialTypeByMatrialTypeIds(Long[] matrialTypeIds);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesBaseMaterialType;
/**
* Service
*
* @author Yinq
* @date 2024-01-23
*/
public interface IMesBaseMaterialTypeService
{
/**
*
*
* @param matrialTypeId
* @return
*/
public MesBaseMaterialType selectMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public List<MesBaseMaterialType> selectMesBaseMaterialTypeList(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public int insertMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param mesBaseMaterialType
* @return
*/
public int updateMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType);
/**
*
*
* @param matrialTypeIds
* @return
*/
public int deleteMesBaseMaterialTypeByMatrialTypeIds(Long[] matrialTypeIds);
/**
*
*
* @param matrialTypeId
* @return
*/
public int deleteMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId);
}

@ -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.MesBaseMaterialTypeMapper;
import com.hw.mes.domain.MesBaseMaterialType;
import com.hw.mes.service.IMesBaseMaterialTypeService;
/**
* Service
*
* @author Yinq
* @date 2024-01-23
*/
@Service
public class MesBaseMaterialTypeServiceImpl implements IMesBaseMaterialTypeService
{
@Autowired
private MesBaseMaterialTypeMapper mesBaseMaterialTypeMapper;
/**
*
*
* @param matrialTypeId
* @return
*/
@Override
public MesBaseMaterialType selectMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId)
{
return mesBaseMaterialTypeMapper.selectMesBaseMaterialTypeByMatrialTypeId(matrialTypeId);
}
/**
*
*
* @param mesBaseMaterialType
* @return
*/
@Override
public List<MesBaseMaterialType> selectMesBaseMaterialTypeList(MesBaseMaterialType mesBaseMaterialType)
{
return mesBaseMaterialTypeMapper.selectMesBaseMaterialTypeList(mesBaseMaterialType);
}
/**
*
*
* @param mesBaseMaterialType
* @return
*/
@Override
public int insertMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType)
{
mesBaseMaterialType.setCreateTime(DateUtils.getNowDate());
return mesBaseMaterialTypeMapper.insertMesBaseMaterialType(mesBaseMaterialType);
}
/**
*
*
* @param mesBaseMaterialType
* @return
*/
@Override
public int updateMesBaseMaterialType(MesBaseMaterialType mesBaseMaterialType)
{
mesBaseMaterialType.setUpdateTime(DateUtils.getNowDate());
return mesBaseMaterialTypeMapper.updateMesBaseMaterialType(mesBaseMaterialType);
}
/**
*
*
* @param matrialTypeIds
* @return
*/
@Override
public int deleteMesBaseMaterialTypeByMatrialTypeIds(Long[] matrialTypeIds)
{
return mesBaseMaterialTypeMapper.deleteMesBaseMaterialTypeByMatrialTypeIds(matrialTypeIds);
}
/**
*
*
* @param matrialTypeId
* @return
*/
@Override
public int deleteMesBaseMaterialTypeByMatrialTypeId(Long matrialTypeId)
{
return mesBaseMaterialTypeMapper.deleteMesBaseMaterialTypeByMatrialTypeId(matrialTypeId);
}
}

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesBaseMaterialTypeMapper">
<resultMap type="MesBaseMaterialType" id="MesBaseMaterialTypeResult">
<result property="matrialTypeId" column="matrial_type_id" />
<result property="parentId" column="parent_id" />
<result property="typeCode" column="type_code" />
<result property="typeName" column="type_name" />
<result property="activeFlag" column="active_flag" />
<result property="ancestors" column="ancestors" />
<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="selectMesBaseMaterialTypeVo">
select matrial_type_id, parent_id, type_code, type_name, active_flag, ancestors, remark, create_by, create_time, update_by, update_time from mes_base_material_type
</sql>
<select id="selectMesBaseMaterialTypeList" parameterType="MesBaseMaterialType" resultMap="MesBaseMaterialTypeResult">
<include refid="selectMesBaseMaterialTypeVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="activeFlag != null and activeFlag != ''"> and active_flag = #{activeFlag}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
</where>
</select>
<select id="selectMesBaseMaterialTypeByMatrialTypeId" parameterType="Long" resultMap="MesBaseMaterialTypeResult">
<include refid="selectMesBaseMaterialTypeVo"/>
where matrial_type_id = #{matrialTypeId}
</select>
<insert id="insertMesBaseMaterialType" parameterType="MesBaseMaterialType" useGeneratedKeys="true" keyProperty="matrialTypeId">
insert into mes_base_material_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="typeCode != null and typeCode != ''">type_code,</if>
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="activeFlag != null">active_flag,</if>
<if test="ancestors != null">ancestors,</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="parentId != null">#{parentId},</if>
<if test="typeCode != null and typeCode != ''">#{typeCode},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="activeFlag != null">#{activeFlag},</if>
<if test="ancestors != null">#{ancestors},</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="updateMesBaseMaterialType" parameterType="MesBaseMaterialType">
update mes_base_material_type
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="typeCode != null and typeCode != ''">type_code = #{typeCode},</if>
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="activeFlag != null">active_flag = #{activeFlag},</if>
<if test="ancestors != null">ancestors = #{ancestors},</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 matrial_type_id = #{matrialTypeId}
</update>
<delete id="deleteMesBaseMaterialTypeByMatrialTypeId" parameterType="Long">
delete from mes_base_material_type where matrial_type_id = #{matrialTypeId}
</delete>
<delete id="deleteMesBaseMaterialTypeByMatrialTypeIds" parameterType="String">
delete from mes_base_material_type where matrial_type_id in
<foreach item="matrialTypeId" collection="array" open="(" separator="," close=")">
#{matrialTypeId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询物料类型信息列表
export function listBaseMaterialType(query) {
return request({
url: '/mes/baseMaterialType/list',
method: 'get',
params: query
})
}
// 查询物料类型信息详细
export function getBaseMaterialType(matrialTypeId) {
return request({
url: '/mes/baseMaterialType/' + matrialTypeId,
method: 'get'
})
}
// 新增物料类型信息
export function addBaseMaterialType(data) {
return request({
url: '/mes/baseMaterialType',
method: 'post',
data: data
})
}
// 修改物料类型信息
export function updateBaseMaterialType(data) {
return request({
url: '/mes/baseMaterialType',
method: 'put',
data: data
})
}
// 删除物料类型信息
export function delBaseMaterialType(matrialTypeId) {
return request({
url: '/mes/baseMaterialType/' + matrialTypeId,
method: 'delete'
})
}

@ -0,0 +1,357 @@
<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="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入父级标识"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="类型编号" prop="typeCode">
<el-input
v-model="queryParams.typeCode"
placeholder="请输入类型编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="类型名称" prop="typeName">
<el-input
v-model="queryParams.typeName"
placeholder="请输入类型名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-select v-model="queryParams.activeFlag" placeholder="请选择激活标识" clearable>
<el-option
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="祖级列表" prop="ancestors">
<el-input
v-model="queryParams.ancestors"
placeholder="请输入祖级列表"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:baseMaterialType:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="baseMaterialTypeList"
row-key="matrialTypeId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
<el-table-column label="类型编号" align="center" prop="typeCode" v-if="columns[2].visible"/>
<el-table-column label="类型名称" align="center" prop="typeName" v-if="columns[3].visible"/>
<el-table-column label="激活标识" align="center" prop="activeFlag" v-if="columns[4].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.activeFlag"/>
</template>
</el-table-column>
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[5].visible"/>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[6].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:baseMaterialType:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['mes:baseMaterialType:add']"
>新增
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:baseMaterialType:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改物料类型信息对话框 -->
<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="parentId">
<treeselect v-model="form.parentId" :options="baseMaterialTypeOptions" :normalizer="normalizer"
placeholder="请选择父级标识"/>
</el-form-item>
<el-form-item label="类型编号" prop="typeCode">
<el-input v-model="form.typeCode" placeholder="请输入类型编号"/>
</el-form-item>
<el-form-item label="类型名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入类型名称"/>
</el-form-item>
<el-form-item label="激活标识" prop="activeFlag">
<el-radio-group v-model="form.activeFlag">
<el-radio
v-for="dict in dict.type.active_flag"
: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 {
listBaseMaterialType,
getBaseMaterialType,
delBaseMaterialType,
addBaseMaterialType,
updateBaseMaterialType
} from "@/api/mes/baseMaterialType";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "BaseMaterialType",
dicts: ['active_flag'],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
baseMaterialTypeList: [],
//
baseMaterialTypeOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
parentId: null,
typeCode: null,
typeName: null,
activeFlag: null,
ancestors: null,
},
//
form: {},
//
rules: {
typeCode: [
{required: true, message: "类型编号不能为空", trigger: "blur"}
],
typeName: [
{required: true, message: "类型名称不能为空", trigger: "blur"}
],
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `父级标识`, visible: false},
{key: 2, label: `类型编号`, visible: true},
{key: 3, label: `类型名称`, visible: true},
{key: 4, label: `激活标识`, visible: true},
{key: 5, label: `祖级列表`, visible: false},
{key: 6, label: `备注`, visible: true},
{key: 7, label: `创建人`, visible: false},
{key: 8, label: `创建时间`, visible: false},
{key: 9, label: `更新人`, visible: false},
{key: 10, label: `更新时间`, visible: false},
],
};
},
created() {
this.getList();
},
methods: {
/** 查询物料类型信息列表 */
getList() {
this.loading = true;
listBaseMaterialType(this.queryParams).then(response => {
this.baseMaterialTypeList = this.handleTree(response.data, "matrialTypeId", "parentId");
this.loading = false;
});
},
/** 转换物料类型信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.matrialTypeId,
label: node.typeName,
children: node.children
};
},
/** 查询物料类型信息下拉树结构 */
getTreeselect() {
listBaseMaterialType().then(response => {
this.baseMaterialTypeOptions = [];
const data = {matrialTypeId: 0, typeName: '顶级节点', children: []};
data.children = this.handleTree(response.data, "matrialTypeId", "parentId");
this.baseMaterialTypeOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
matrialTypeId: null,
parentId: null,
typeCode: null,
typeName: null,
activeFlag: '1',
ancestors: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.matrialTypeId) {
this.form.parentId = row.matrialTypeId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加物料类型信息";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.matrialTypeId;
}
getBaseMaterialType(row.matrialTypeId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改物料类型信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.matrialTypeId != null) {
updateBaseMaterialType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBaseMaterialType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除物料类型信息编号为"' + row.matrialTypeId + '"的数据项?').then(function () {
return delBaseMaterialType(row.matrialTypeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
}
};
</script>
Loading…
Cancel
Save