# Conflicts:
#	yanzhu-mapper/src/main/resources/mapper/base/BaseAssetsTypeMapper.xml
main
姜玉琦 2024-02-25 21:48:47 +08:00
commit 0c07df22fd
4 changed files with 99 additions and 140 deletions

View File

@ -52,6 +52,16 @@ public class SysDept extends BaseEntity
/** 父部门名称 */
private String parentName;
private String unit;
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
/** 子部门 */
private List<SysDept> children = new ArrayList<SysDept>();
@ -197,7 +207,7 @@ public class SysDept extends BaseEntity
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("unit", getUnit())
.toString();
}
}

View File

@ -1,9 +1,9 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yanzhu.base.mapper.BaseAssetsTypeMapper">
<resultMap type="BaseAssetsType" id="BaseAssetsTypeResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBaseAssetsTypeList" parameterType="BaseAssetsType" resultMap="BaseAssetsTypeResult">
<include refid="selectBaseAssetsTypeVo"/>
<where>
<where>
<if test="parentId != null ">
<if test="parentId == 0 ">
and parent_id is null
@ -42,12 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="defaultDeptId != null"> and (dept_id is null or dept_id = #{defaultDeptId})</if>
</where>
</select>
<select id="selectBaseAssetsTypeById" parameterType="Long" resultMap="BaseAssetsTypeResult">
<include refid="selectBaseAssetsTypeVo"/>
where id = #{id}
</select>
<insert id="insertBaseAssetsType" parameterType="BaseAssetsType" useGeneratedKeys="true" keyProperty="id">
insert into base_assets_type
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="deptId != null">#{deptId},</if>
@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</trim>
</insert>
<update id="updateBaseAssetsType" parameterType="BaseAssetsType">
@ -101,7 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteBaseAssetsTypeByIds" parameterType="String">
delete from base_assets_type where id in
delete from base_assets_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="unit" column="unit" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.unit
from sys_dept d
</sql>
@ -99,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="unit != null and unit != ''">unit,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
@ -111,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="unit != null and unit != ''">#{unit},</if>
sysdate()
)
</insert>
@ -127,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}

View File

@ -1,57 +1,29 @@
<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 label="公司名称" prop="compyId">
<el-select v-model="queryParams.compyId" placeholder="请选择公司名称" @change="doCompyChange">
<el-option v-for="it in compyOpts" :key="it.deptId" :label="it.deptName" :value="it.deptId" />
</el-select>
</el-form-item>
<el-form-item label="单位主键" prop="deptId">
<el-input
v-model="queryParams.deptId"
placeholder="请输入单位主键"
clearable
@keyup.enter.native="handleQuery"
/>
<el-form-item label="项目名称" prop="defaultDeptId">
<el-select v-model="queryParams.defaultDeptId" placeholder="请选择项目名称">
<el-option v-for="it in prjOpts" :key="it.deptId" :label="it.deptName" :value="it.deptId" />
</el-select>
</el-form-item>
<el-form-item label="资产类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择资产类型" clearable>
<el-option
v-for="dict in dict.type.pro_assets_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
<el-option v-for="dict in dict.type.pro_assets_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="资产名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入资产名称"
clearable
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.name" placeholder="请输入资产名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="资产单位" prop="unit">
<el-input
v-model="queryParams.unit"
placeholder="请输入资产单位"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择是否删除" clearable>
<el-option
v-for="dict in dict.type.sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-input v-model="queryParams.unit" 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>
@ -61,95 +33,53 @@
<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="['base:assetsType:add']"
>新增</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['base:assetsType: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="['base:assetsType:edit']"
>修改</el-button>
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['base:assetsType: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="['base:assetsType:remove']"
>删除</el-button>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['base:assetsType: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="['base:assetsType:export']"
>导出</el-button>
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['base:assetsType:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="assetsTypeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="父级分类" align="center" prop="parentId" />
<el-table-column label="单位主键" align="center" prop="deptId" />
<el-table-column label="资产类型" align="center" prop="type">
<el-table-column label="主键" align="center" prop="id" width="55"/>
<el-table-column label="资产类型" align="center" prop="type" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.pro_assets_type" :value="scope.row.type"/>
<dict-tag :options="dict.type.pro_assets_type" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="资产名称" align="center" prop="name" />
<el-table-column label="资产单位" align="center" prop="unit" />
<el-table-column label="是否删除" align="center" prop="isDel">
<el-table-column label="资产名称" align="left" prop="name">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_is_del" :value="scope.row.isDel"/>
<el-tag v-if="!scope.row.deptId" effect="dark" type="danger"></el-tag>
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="资产单位" align="center" prop="unit" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:assetsType:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:assetsType:remove']"
>删除</el-button>
<template v-if="scope.row.deptId">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['base:assetsType:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:assetsType:remove']">删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<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>
@ -162,12 +92,8 @@
</el-form-item>
<el-form-item label="资产类型" prop="type">
<el-select v-model="form.type" placeholder="请选择资产类型">
<el-option
v-for="dict in dict.type.pro_assets_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
<el-option v-for="dict in dict.type.pro_assets_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="资产名称" prop="name">
@ -178,12 +104,8 @@
</el-form-item>
<el-form-item label="是否删除" prop="isDel">
<el-select v-model="form.isDel" placeholder="请选择是否删除">
<el-option
v-for="dict in dict.type.sys_is_del"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
<el-option v-for="dict in dict.type.sys_is_del" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
@ -200,12 +122,15 @@
<script>
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType } from "@/api/base/assetsType";
import { listDept } from '@/api/system/dept'
export default {
name: "AssetsType",
dicts: ['pro_assets_type', 'sys_is_del'],
data() {
return {
depOpts: [],
compyOpts: [],
prjOpts: [],
//
loading: true,
//
@ -229,7 +154,8 @@ export default {
pageNum: 1,
pageSize: 10,
parentId: null,
deptId: null,
compyId: null,
defaultDeptId: null,
type: null,
name: null,
unit: null,
@ -243,9 +169,27 @@ export default {
};
},
created() {
this.getList();
listDept().then(d => {
this.depOpts = d.data || [];
this.compyOpts = this.depOpts.filter(it => it.parentId == 100)
if (this.compyOpts.length > 0) {
this.queryParams.compyId = this.compyOpts[0].deptId;
this.prjOpts = this.depOpts.filter(it => it.parentId == this.queryParams.compyId);
if (this.prjOpts.length > 0) {
this.queryParams.defaultDeptId = this.prjOpts[0].deptId;
this.getList();
}
}
});
},
methods: {
doCompyChange(a) {
this.prjOpts = this.depOpts.filter(it => it.parentId == this.queryParams.compyId);
if (this.prjOpts.length > 0) {
this.queryParams.defaultDeptId = this.prjOpts[0].deptId;
}
},
/** 查询物资类型列表 */
getList() {
this.loading = true;
@ -289,9 +233,10 @@ export default {
this.handleQuery();
},
//
handleSelectionChange(selection) {
handleSelectionChange(sel) {
let selection=sel.filter(d=>d.deptId);
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
@ -333,12 +278,12 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除物资类型编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除物资类型编号为"' + ids + '"的数据项?').then(function () {
return delAssetsType(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
@ -348,4 +293,4 @@ export default {
}
}
};
</script>
</script>