Commit d1cc0c23 authored by lenovo's avatar lenovo

一级分类/二级分类缺陷修复,新增一级分类模块,运行前先运行sql文件夹里的suppliesmenu.sql

parent 98ff0923
...@@ -53,10 +53,24 @@ public class ActSuppliesController extends BaseController ...@@ -53,10 +53,24 @@ public class ActSuppliesController extends BaseController
public TableDataInfo list(ActSupplies actSupplies) public TableDataInfo list(ActSupplies actSupplies)
{ {
startPage(); startPage();
List<ActSupplies> list = actSuppliesService.selectActSuppliesList(actSupplies); List<ActSupplies> list = actSuppliesService.selectActSuppliesList(actSupplies);;
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询物料总分类管理列表
*/
@PreAuthorize("@ss.hasPermi('Actsupplies:Actsupplies:listOne')")
@GetMapping("/listOne")
public TableDataInfo listOne(ActSupplies actSupplies)
{
startPage();
List<ActSupplies> list = actSuppliesService.selectActSuppliesListOne(actSupplies);;
return getDataTable(list);
}
/** /**
* 导出物料总分类管理列表 * 导出物料总分类管理列表
*/ */
......
...@@ -78,4 +78,5 @@ public interface ActSuppliesMapper ...@@ -78,4 +78,5 @@ public interface ActSuppliesMapper
*/ */
public int countBySuppliesName(String suppliesName); public int countBySuppliesName(String suppliesName);
List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies);
} }
...@@ -89,5 +89,5 @@ public interface IActSuppliesService ...@@ -89,5 +89,5 @@ public interface IActSuppliesService
List<Integer> findId(Long id); List<Integer> findId(Long id);
List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies);
} }
...@@ -160,6 +160,12 @@ public class ActSuppliesServiceImpl implements IActSuppliesService ...@@ -160,6 +160,12 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.findId(id); return actSuppliesMapper.findId(id);
} }
@Override
public List<ActSupplies> selectActSuppliesListOne(ActSupplies actSupplies) {
return actSuppliesMapper.selectActSuppliesListOne(actSupplies);
}
private void updateStatusById(Long id, Integer status){ private void updateStatusById(Long id, Integer status){
String[] statusText={"禁用","启用"}; String[] statusText={"禁用","启用"};
......
...@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ActSupplies" id="ActSuppliesResult"> <resultMap type="ActSupplies" id="ActSuppliesResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="pid" column="pid" /> <result property="pid" column="pid" />
<result property="fname" column="fname"/>
<result property="suppliesName" column="supplies_name" /> <result property="suppliesName" column="supplies_name" />
<result property="orderNum" column="order_num" /> <result property="orderNum" column="order_num" />
<result property="status" column="status" /> <result property="status" column="status" />
...@@ -46,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -46,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="saveSid" parameterType="com.ruoyi.system.domain.ActSupplies" resultMap="ActSuppliesResult"> <select id="saveSid" parameterType="com.ruoyi.system.domain.ActSupplies" resultMap="ActSuppliesResult">
select id,pid,supplies_name from act_supplies where status = 0; -- select id,pid,supplies_name from act_supplies where status = 0;
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a LEFT JOIN act_supplies b on a.pid =b.id where a.status = 0
</select> </select>
<select id="selectActSuppliesDetailsList" parameterType="ActSuppliesDetails" resultMap="OneActSuppliesDetailsResult"> <select id="selectActSuppliesDetailsList" parameterType="ActSuppliesDetails" resultMap="OneActSuppliesDetailsResult">
......
...@@ -26,8 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -26,8 +26,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(*) from act_supplies where supplies_name=#{suppliesName} select count(*) from act_supplies where supplies_name=#{suppliesName}
</select> </select>
<select id="selectActSuppliesList" parameterType="ActSupplies" resultMap="ActSuppliesResult"> <select id="selectActSuppliesList" parameterType="ActSupplies" resultMap="ActSuppliesResult">
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a left join act_supplies b on a.pid =b.id select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a , act_supplies b
<where> <where>
and a.pid =b.id
<if test="id != null "> and a.id = #{id}</if> <if test="id != null "> and a.id = #{id}</if>
<if test="pid != null">and a.pid = #{pid}</if> <if test="pid != null">and a.pid = #{pid}</if>
<if test="fname != null "> and b.supplies_name like concat('%', #{fname}, '%')</if> <if test="fname != null "> and b.supplies_name like concat('%', #{fname}, '%')</if>
...@@ -36,6 +37,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -36,6 +37,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where> </where>
</select> </select>
<select id="selectActSuppliesListOne" parameterType="ActSupplies" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/>
<where>
and pid = 0
<if test="id != null "> and id = #{id}</if>
<if test="suppliesName != null and suppliesName != ''"> and supplies_name like concat('%', #{suppliesName}, '%')</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectActSuppliesById" parameterType="Long" resultMap="ActSuppliesResult"> <select id="selectActSuppliesById" parameterType="Long" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/> <include refid="selectActSuppliesVo"/>
where id = #{id} where id = #{id}
...@@ -43,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -43,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="options" parameterType="ActSupplies" resultMap="ActSuppliesResult"> <select id="options" parameterType="ActSupplies" resultMap="ActSuppliesResult">
<include refid="selectActSuppliesVo"/> <include refid="selectActSuppliesVo"/>
where pid = 0 where pid = 0 and status = 0
</select> </select>
<insert id="insertActSupplies" parameterType="ActSupplies" useGeneratedKeys="true" keyProperty="id"> <insert id="insertActSupplies" parameterType="ActSupplies" useGeneratedKeys="true" keyProperty="id">
......
import request from '@/utils/request' import request from '@/utils/request'
// 查询物料关系管理列表 // 查询二级分类列表
export function listSupplies(query) { export function listSupplies(query) {
return request({ return request({
url: '/Actsupplies/Actsupplies/list', url: '/Actsupplies/Actsupplies/list',
...@@ -9,6 +9,15 @@ export function listSupplies(query) { ...@@ -9,6 +9,15 @@ export function listSupplies(query) {
}) })
} }
// 查询一级分类列表
export function listSuppliesOne(query) {
return request({
url: '/Actsupplies/Actsupplies/listOne',
method: 'get',
params: query
})
}
// 查询物料关系管理详细 // 查询物料关系管理详细
export function getSupplies(id) { export function getSupplies(id) {
return request({ return request({
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-option <el-option
v-for="option in options2" v-for="option in options2"
:key="option.suppliesName" :key="option.suppliesName"
:label="option.suppliesName" :label="option.fname==null ? option.id+'-'+option.suppliesName : option.fname+'-'+option.suppliesName"
:value="option.id" :value="option.id"
></el-option> ></el-option>
...@@ -92,13 +92,10 @@ ...@@ -92,13 +92,10 @@
<el-table v-loading="loading" :data="ActSuppliesDetailsList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="ActSuppliesDetailsList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" width="80" align="center" label="序号" :index="indexMethod" /> <el-table-column type="index" width="80" align="center" label="序号" :index="indexMethod" />
<el-table-column label="所属分类" align="center"> <el-table-column label="上级分类" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<template v-if="scope.row.fname === null"> <template>
其他
</template>
<template v-else>
{{ scope.row.fname }} {{ scope.row.fname }}
</template> </template>
</div> </div>
...@@ -156,13 +153,12 @@ ...@@ -156,13 +153,12 @@
<el-option <el-option
v-for="option in options2" v-for="option in options2"
:key="option.suppliesName" :key="option.suppliesName"
:label="option.suppliesName" :label="option.fname==null ? option.id+'-'+option.suppliesName : option.fname+'-'+option.suppliesName"
:value="option.id" :value="option.id"
></el-option> ></el-option>
<el-option label="其他" value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="小类物料名称" prop="detailsName"> <el-form-item label="物料名称" prop="detailsName">
<el-input v-model="form.detailsName" placeholder="请输入物料名称" /> <el-input v-model="form.detailsName" placeholder="请输入物料名称" />
</el-form-item> </el-form-item>
<el-form-item label="所属系统" prop="sysclassify"> <el-form-item label="所属系统" prop="sysclassify">
...@@ -351,7 +347,7 @@ export default { ...@@ -351,7 +347,7 @@ export default {
this.fetchOptions(); this.fetchOptions();
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加物料"; this.title = "新增物料";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="大类名称" prop="pid"> <el-form-item label="一级分类名称" prop="pid" label-width="100px">
<el-select v-model="queryParams.pid" filterable clearable placeholder="请输入上级分类" > <el-select v-model="queryParams.pid" filterable clearable placeholder="请输入一级分类分类名称">
<el-option <el-option
v-for="option in options" v-for="option in options"
:key="option.suppliesName" :key="option.suppliesName"
:label="option.suppliesName" :label="option.suppliesName"
:value="option.id" :value="option.id"
></el-option> ></el-option>
<el-option label="无" value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物料名称" prop="suppliesName"> <el-form-item label="物料名称" prop="suppliesName">
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['supplies:supplies:add']" v-hasPermi="['supplies:supplies:add']"
>新增</el-button> >新增二级分类</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -83,19 +82,16 @@ ...@@ -83,19 +82,16 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="ID" align="center" prop="id" />--> <!-- <el-table-column label="ID" align="center" prop="id" />-->
<el-table-column type="index" width="80" align="center" label="序号" :index="indexMethod" /> <el-table-column type="index" width="80" align="center" label="序号" :index="indexMethod" />
<el-table-column label="类名称" align="center"> <el-table-column label="一级分类名称" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
<template v-if="scope.row.fname === null"> <template>
</template>
<template v-else>
{{ scope.row.fname }} {{ scope.row.fname }}
</template> </template>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="物料名称" align="center" prop="suppliesName" /> <el-table-column label="二级分类名称" align="center" prop="suppliesName" />
<el-table-column label="状态" align="center"> <el-table-column label="状态" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div> <div>
...@@ -139,19 +135,18 @@ ...@@ -139,19 +135,18 @@
<!-- 添加或修改物料总分类管理对话框 --> <!-- 添加或修改物料总分类管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="所属类" prop="pid"> <el-form-item label="所属一级分类" prop="pid">
<el-select v-model="form.pid" filterable placeholder="请输入所属类" > <el-select v-model="form.pid" filterable placeholder="请输入所属一级分类" >
<el-option <el-option
v-for="option in options" v-for="option in options"
:key="option.suppliesName" :key="option.suppliesName"
:label="option.suppliesName" :label="option.suppliesName"
:value="option.id" :value="option.id"
></el-option> ></el-option>
<el-option label="无" :value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="物料名称" prop="suppliesName"> <el-form-item label="物料名称" prop="suppliesName">
<el-input v-model="form.suppliesName" placeholder="请输入物料名称" /> <el-input v-model="form.suppliesName" placeholder="请输入二级分类名称" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请选择状态"> <el-select v-model="form.status" placeholder="请选择状态">
...@@ -165,6 +160,7 @@ ...@@ -165,6 +160,7 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -201,8 +197,10 @@ export default { ...@@ -201,8 +197,10 @@ export default {
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
opentwo: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
id: null, id: null,
...@@ -282,7 +280,6 @@ export default { ...@@ -282,7 +280,6 @@ export default {
/** 查询上级关联关系*/ /** 查询上级关联关系*/
fetchOptions() { fetchOptions() {
getPid().then(response => { getPid().then(response => {
console.log(response.rows)
this.options = response.rows; this.options = response.rows;
}); });
}, },
...@@ -300,6 +297,7 @@ export default { ...@@ -300,6 +297,7 @@ export default {
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
this.opentwo = false;
this.reset(); this.reset();
}, },
// 表单重置 // 表单重置
...@@ -322,9 +320,6 @@ export default { ...@@ -322,9 +320,6 @@ export default {
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
if ('最高级'.indexOf(this.queryParams.fname) !== -1){
this.queryParams.pid = 0;
}
this.getList(); this.getList();
}, },
...@@ -341,10 +336,9 @@ export default { ...@@ -341,10 +336,9 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.fetchOptions();
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加物料总分类管理"; this.title = "新增二级分类";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -364,13 +358,15 @@ export default { ...@@ -364,13 +358,15 @@ export default {
updateSupplies(this.form).then(response => { updateSupplies(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.opentwo = false;
this.getList();
}); });
} else { } else {
addSupplies(this.form).then(response => { addSupplies(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.opentwo = false;
this.getList();
}); });
} }
} }
......
This diff is collapsed.
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类', '1169', '1', 'supplies', 'system/supplies/index', 1, 0, 'C', '0', '0', 'system:supplies:list', '#', 'admin', sysdate(), '', null, '一级分类菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'system:supplies:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'system:supplies:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'system:supplies:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'system:supplies:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('一级分类导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'system:supplies:export', '#', 'admin', sysdate(), '', null, '');
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment