unit单位初始化
This commit is contained in:
22
ZR.Admin.WebApi/Controllers/mes/md/UnitController.cs
Normal file
22
ZR.Admin.WebApi/Controllers/mes/md/UnitController.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Service.mes.md.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.md;
|
||||
//http://localhost:8887/dev-api/mes/md/unit/list
|
||||
[Route("mes/md/unit")]
|
||||
public class UnitController : BaseController
|
||||
{
|
||||
private IUnitService unitService;
|
||||
public UnitController(IUnitService unitService)
|
||||
{
|
||||
this.unitService = unitService;
|
||||
}
|
||||
|
||||
[HttpGet("list")]
|
||||
public IActionResult Getlist(int pageNum,int pagesize)
|
||||
{
|
||||
UnitPageDTO unitPageDto = unitService.GetList(pageNum, pagesize);
|
||||
return SUCCESS(unitPageDto);
|
||||
}
|
||||
}
|
||||
@@ -12,4 +12,16 @@
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.84" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
7
ZR.Model/mes/md/DTO/UnitPageDTO.cs
Normal file
7
ZR.Model/mes/md/DTO/UnitPageDTO.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace ZR.Model.mes.md.DTO;
|
||||
|
||||
public class UnitPageDTO
|
||||
{
|
||||
public List<Unit> list;
|
||||
public int Total;
|
||||
}
|
||||
100
ZR.Model/mes/md/Unit.cs
Normal file
100
ZR.Model/mes/md/Unit.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
namespace ZR.Model.mes.md
|
||||
{
|
||||
/// <summary>
|
||||
/// 计量单位
|
||||
///</summary>
|
||||
[SugarTable("md_unit")]
|
||||
public class Unit
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "measure_id", IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int MeasureId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "measure_code")]
|
||||
public string MeasureCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "measure_name")]
|
||||
public string MeasureName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用(不启用0,启用1)
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "enable_flag")]
|
||||
public string EnableFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "remark")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预留字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "attr1")]
|
||||
public string Attr1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预留字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "attr2")]
|
||||
public string Attr2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预留字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "attr3")]
|
||||
public int? Attr3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预留字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "attr4")]
|
||||
public string Attr4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户号
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "TENANT_ID")]
|
||||
public string TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 乐观锁
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "REVISION")]
|
||||
public int? Revision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "CREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "UPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
11
ZR.Service/mes/md/IService/IUnitService.cs
Normal file
11
ZR.Service/mes/md/IService/IUnitService.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
|
||||
namespace ZR.Service.mes.md.IService;
|
||||
|
||||
public interface IUnitService
|
||||
{
|
||||
|
||||
public UnitPageDTO GetList(int pageNum, int pageSize);
|
||||
}
|
||||
36
ZR.Service/mes/md/UnitService.cs
Normal file
36
ZR.Service/mes/md/UnitService.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.md.DTO;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service.mes.md.IService;
|
||||
using ZR.Service.System.IService;
|
||||
using NotImplementedException = System.NotImplementedException;
|
||||
|
||||
namespace ZR.Service.mes.md;
|
||||
|
||||
/// <summary>
|
||||
/// 文件管理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IUnitService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class UnitService : BaseService<Unit>, IUnitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public UnitPageDTO GetList(int pageNum,int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
List<Unit> data = Context.Queryable<Unit>().ToPageList(pageNum, pageSize, ref totalNum);
|
||||
UnitPageDTO unitPageDto = new UnitPageDTO();
|
||||
unitPageDto.list = data;
|
||||
unitPageDto.Total = totalNum;
|
||||
return unitPageDto ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
ENV = 'production'
|
||||
|
||||
# 页面标题
|
||||
VUE_APP_TITLE = 'ZrAdmin.NET后台管理'
|
||||
VUE_APP_TITLE = '上海干巷MES'
|
||||
|
||||
# 生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
|
||||
@@ -32,6 +32,8 @@ import DictTag from '@/components/DictTag'
|
||||
import UploadImage from '@/components/UploadImage/index';
|
||||
// 上传文件
|
||||
import UploadFile from '@/components/FileUpload/index';
|
||||
// 字典数据组件
|
||||
import DictData from '@/components/DictData'
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
@@ -71,6 +73,7 @@ Vue.use(plugins)
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'small' // set element-ui default size
|
||||
})
|
||||
DictData.install()
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
||||
@@ -231,4 +231,20 @@ export async function blobValidate(data) {
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 数据合并
|
||||
export function mergeRecursive(source, target) {
|
||||
for (var p in target) {
|
||||
try {
|
||||
if (target[p].constructor == Object) {
|
||||
source[p] = mergeRecursive(source[p], target[p]);
|
||||
} else {
|
||||
source[p] = target[p];
|
||||
}
|
||||
} catch (e) {
|
||||
source[p] = target[p];
|
||||
}
|
||||
}
|
||||
return source;
|
||||
};
|
||||
@@ -1,15 +1,117 @@
|
||||
<template>
|
||||
<div>
|
||||
unit
|
||||
<div class="app-container">
|
||||
<el-form ref="unit" :model="unit" label-width="80px" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="单位编码">
|
||||
<el-input v-model="unit.code"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称">
|
||||
<el-input v-model="unit.name"></el-input>
|
||||
</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">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="单位编码" align="center" prop="measureCode" />
|
||||
<el-table-column label="单位名称" align="center" prop="measureName" />
|
||||
<el-table-column label="是否启用" align="center" prop="enableFlag" >
|
||||
<template slot-scope="scope">
|
||||
<dict-tag1 :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination :v-show="true" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import {
|
||||
listUnitmeasure,
|
||||
listPrimaryUnitmeasure,
|
||||
getUnitmeasure,
|
||||
delUnitmeasure,
|
||||
addUnitmeasure,
|
||||
updateUnitmeasure,
|
||||
} from '@/api/basisManagement/unit.js'
|
||||
|
||||
export default {
|
||||
name: 'unit',
|
||||
dicts: ['sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
multiple: false,
|
||||
total: 1,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
},
|
||||
|
||||
unit: {
|
||||
code: '1',
|
||||
name: 'name',
|
||||
},
|
||||
unitList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleQuery() {},
|
||||
resetQuery() {
|
||||
this.unit.code = ''
|
||||
this.unit.name = ''
|
||||
},
|
||||
handleAdd() {},
|
||||
handleUpdate() {},
|
||||
handleDelete() {},
|
||||
handleExport() {},
|
||||
// 获取list
|
||||
getList() {
|
||||
this.loading = true
|
||||
listUnitmeasure(this.queryParams).then((response) => {
|
||||
this.unitList = response.data.list
|
||||
this.total = response.data.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
//处理多选
|
||||
handleSelectionChange() {},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user