添加供应商定义模块
This commit is contained in:
@@ -181,12 +181,40 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetList">
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.PageList(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||||
<summary>
|
<summary>
|
||||||
查
|
分页查
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetById(System.Int64)">
|
||||||
|
<summary>
|
||||||
|
单查
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Create(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
|
||||||
|
<summary>
|
||||||
|
增
|
||||||
|
</summary>
|
||||||
|
<param name="input"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Update(System.Int64,Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput)">
|
||||||
|
<summary>
|
||||||
|
更
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<param name="input"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.Del(System.Collections.Generic.List{System.Int64})">
|
||||||
|
<summary>
|
||||||
|
删
|
||||||
|
</summary>
|
||||||
|
<param name="ids"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
<member name="T:Yi.Framework.ApiMicroservice.Controllers.AccountController">
|
||||||
<summary>
|
<summary>
|
||||||
账户管理
|
账户管理
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ using Yi.Framework.Interface.ERP;
|
|||||||
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("[controller]")]
|
[Route("api/[controller]/[action]")]
|
||||||
public class SupplierController:ControllerBase
|
public class SupplierController : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly ILogger<SupplierController> _logger;
|
private readonly ILogger<SupplierController> _logger;
|
||||||
private readonly ISupplierService _supplierService;
|
private readonly ISupplierService _supplierService;
|
||||||
@@ -19,15 +19,64 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查
|
/// 分页查
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<Result<List<SupplierGetListOutput>>> GetList()
|
public async Task<Result> PageList([FromQuery] SupplierCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||||
{
|
{
|
||||||
var result = await _supplierService.GetListAsync();
|
var result = await _supplierService.PageListAsync(input, page);
|
||||||
|
return Result.Success().SetData(result);
|
||||||
|
}
|
||||||
|
|
||||||
return Result<List<SupplierGetListOutput>>.Success().SetData(result);
|
/// <summary>
|
||||||
|
/// 单查
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("{id}")]
|
||||||
|
public async Task<Result> GetById(long id)
|
||||||
|
{
|
||||||
|
var result = await _supplierService.GetByIdAsync(id);
|
||||||
|
return Result.Success().SetData(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 增
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Result> Create(SupplierCreateUpdateInput input)
|
||||||
|
{
|
||||||
|
var result = await _supplierService.CreateAsync(input);
|
||||||
|
return Result.Success().SetData(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut]
|
||||||
|
[Route("{id}")]
|
||||||
|
public async Task<Result> Update(long id, SupplierCreateUpdateInput input)
|
||||||
|
{
|
||||||
|
var result = await _supplierService.UpdateAsync(id, input);
|
||||||
|
return Result.Success().SetData(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ids"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete]
|
||||||
|
public async Task<Result> Del(List<long> ids)
|
||||||
|
{
|
||||||
|
await _supplierService.DeleteAsync(ids);
|
||||||
|
return Result.Success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
using Yi.Framework.DtoModel.ERP.Supplier;
|
using Yi.Framework.DtoModel.ERP.Supplier;
|
||||||
using Yi.Framework.Interface.Base.Crud;
|
using Yi.Framework.Interface.Base.Crud;
|
||||||
|
|
||||||
@@ -10,6 +11,6 @@ namespace Yi.Framework.Interface.ERP
|
|||||||
{
|
{
|
||||||
public interface ISupplierService : ICrudAppService<SupplierGetListOutput, long, SupplierCreateUpdateInput>
|
public interface ISupplierService : ICrudAppService<SupplierGetListOutput, long, SupplierCreateUpdateInput>
|
||||||
{
|
{
|
||||||
Task<List<SupplierGetListOutput>> GetListAsync();
|
Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Yi.Framework.Model.RABC.SeedData
|
|||||||
{
|
{
|
||||||
Id = SnowFlakeSingle.Instance.NextId(),
|
Id = SnowFlakeSingle.Instance.NextId(),
|
||||||
DictLabel = "显示",
|
DictLabel = "显示",
|
||||||
DictValue = "0",
|
DictValue = "true",
|
||||||
DictType = "sys_show_hide",
|
DictType = "sys_show_hide",
|
||||||
OrderNum = 100,
|
OrderNum = 100,
|
||||||
Remark = "显示菜单",
|
Remark = "显示菜单",
|
||||||
@@ -66,7 +66,7 @@ namespace Yi.Framework.Model.RABC.SeedData
|
|||||||
{
|
{
|
||||||
Id = SnowFlakeSingle.Instance.NextId(),
|
Id = SnowFlakeSingle.Instance.NextId(),
|
||||||
DictLabel = "隐藏",
|
DictLabel = "隐藏",
|
||||||
DictValue = "1",
|
DictValue = "false",
|
||||||
DictType = "sys_show_hide",
|
DictType = "sys_show_hide",
|
||||||
OrderNum = 99,
|
OrderNum = 99,
|
||||||
Remark = "隐藏菜单",
|
Remark = "隐藏菜单",
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
<ProjectReference Include="..\Yi.Framework.Model\Yi.Framework.Model.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ namespace Yi.Framework.Service.Base.Crud
|
|||||||
|
|
||||||
TryToSetTenantId(entity);
|
TryToSetTenantId(entity);
|
||||||
|
|
||||||
await Repository.InsertAsync(entity);
|
//这边需要进行判断,实体是什么guid还是雪花id
|
||||||
|
await Repository.InsertReturnSnowflakeIdAsync(entity);
|
||||||
|
|
||||||
var entitydto = await MapToGetOutputDtoAsync(entity);
|
var entitydto = await MapToGetOutputDtoAsync(entity);
|
||||||
return entitydto;
|
return entitydto;
|
||||||
@@ -80,7 +81,7 @@ namespace Yi.Framework.Service.Base.Crud
|
|||||||
/// <param name="ids"></param>
|
/// <param name="ids"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public virtual Task DeleteAsync(IEnumerable<TKey> ids)
|
public virtual Task DeleteAsync(IEnumerable<TKey> ids)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ namespace Yi.Framework.Service.Base.Crud
|
|||||||
/// <param name="idEntity"></param>
|
/// <param name="idEntity"></param>
|
||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected virtual Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto)
|
protected virtual Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Yi.Framework.Common.Models;
|
||||||
using Yi.Framework.DtoModel.ERP.Supplier;
|
using Yi.Framework.DtoModel.ERP.Supplier;
|
||||||
using Yi.Framework.Interface.ERP;
|
using Yi.Framework.Interface.ERP;
|
||||||
using Yi.Framework.Model.ERP.Entitys;
|
using Yi.Framework.Model.ERP.Entitys;
|
||||||
@@ -17,10 +19,14 @@ namespace Yi.Framework.Service.ERP
|
|||||||
public SupplierService(IRepository<SupplierEntity> repository, IMapper mapper) : base(repository, mapper)
|
public SupplierService(IRepository<SupplierEntity> repository, IMapper mapper) : base(repository, mapper)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public async Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page)
|
||||||
public async Task<List<SupplierGetListOutput>> GetListAsync()
|
|
||||||
{
|
{
|
||||||
return await MapToGetListOutputDtosAsync(await Repository.GetListAsync());
|
RefAsync<int> totalNumber = 0;
|
||||||
|
var data = await Repository._DbQueryable
|
||||||
|
.WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code))
|
||||||
|
.WhereIF(input.Name is not null, u => u.Name.Contains(input.Name))
|
||||||
|
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||||
|
return new PageModel<List<SupplierGetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ namespace Yi.Framework.WebCore.AspNetCoreExtensions
|
|||||||
{
|
{
|
||||||
sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}");
|
sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}");
|
||||||
}
|
}
|
||||||
|
sb.Append( $"\r\n 完整SQL:{UtilMethods.GetSqlString(DbType.MySql, s, p)}");
|
||||||
_logger?.LogInformation(sb.ToString());
|
_logger?.LogInformation(sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
public class ErrorHandExtension
|
public class ErrorHandExtension
|
||||||
{
|
{
|
||||||
private readonly RequestDelegate next;
|
private readonly RequestDelegate next;
|
||||||
|
private readonly ILogger<ErrorHandExtension> _logger;
|
||||||
//private readonly IErrorHandle _errorHandle;
|
//private readonly IErrorHandle _errorHandle;
|
||||||
public ErrorHandExtension(RequestDelegate next/*, IErrorHandle errorHandle*/)
|
public ErrorHandExtension(RequestDelegate next, ILoggerFactory loggerFactory /*, IErrorHandle errorHandle*/)
|
||||||
{
|
{
|
||||||
this.next = next;
|
this.next = next;
|
||||||
//this._logger = loggerFactory.CreateLogger<ErrorHandExtension>();
|
this._logger = loggerFactory.CreateLogger<ErrorHandExtension>();
|
||||||
//_errorHandle = errorHandle;
|
//_errorHandle = errorHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.LogError("系统错误",ex);
|
||||||
//await _errorHandle.Invoer(context, ex);
|
//await _errorHandle.Invoer(context, ex);
|
||||||
var statusCode = context.Response.StatusCode;
|
var statusCode = context.Response.StatusCode;
|
||||||
if (ex is ArgumentException)
|
if (ex is ArgumentException)
|
||||||
|
|||||||
@@ -258,7 +258,7 @@
|
|||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in sys_show_hide"
|
v-for="dict in sys_show_hide"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="JSON.parse(dict.value)"
|
||||||
>{{ dict.label }}</el-radio>
|
>{{ dict.label }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
45
Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js
Normal file
45
Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
|
export function listData(query) {
|
||||||
|
return request({
|
||||||
|
url: '/supplier/pageList',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// id查询
|
||||||
|
export function getData(code) {
|
||||||
|
return request({
|
||||||
|
url: '/supplier/getById/' + code,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
export function addData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/supplier/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
export function updateData(id,data) {
|
||||||
|
return request({
|
||||||
|
url: `/supplier/update/${id}`,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
export function delData(code) {
|
||||||
|
return request({
|
||||||
|
url: '/supplier/del',
|
||||||
|
method: 'delete',
|
||||||
|
data:"string"==typeof(code)?[code]:code
|
||||||
|
})
|
||||||
|
}
|
||||||
396
Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue
Normal file
396
Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue
Normal file
@@ -0,0 +1,396 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryRef"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<el-form-item label="供应商名称" prop="title" >
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入供应商名称"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
prop="name"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="供应商编号" prop="title" >
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.code"
|
||||||
|
placeholder="请输入供应商编号"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
prop="code"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.isDeleted"
|
||||||
|
placeholder="状态"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item> -->
|
||||||
|
<!-- <el-form-item label="创建时间" style="width: 308px">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="Refresh" @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="Plus"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['erp:supplier:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['erp:supplier:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['erp:supplier:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['erp:supplier:export']"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
v-model:showSearch="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="dataList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
|
||||||
|
<!-----------------------这里开始就是数据表单的全部列------------------------>
|
||||||
|
<el-table-column label="供应商编号" align="center" prop="code" />
|
||||||
|
|
||||||
|
<el-table-column label="供应商名称" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
|
<el-table-column label="详细地址" align="center" prop="address" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
|
<el-table-column label="联系人" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
|
<el-table-column label="联系电话" align="center" prop="phone" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
|
<el-table-column label="传真" align="center" prop="fax" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
|
<el-table-column label="邮箱" align="center" prop="email" :show-overflow-tooltip="true"/>
|
||||||
|
<!-- <el-table-column label="状态" align="center" prop="isDeleted">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag
|
||||||
|
:options="sys_normal_disable"
|
||||||
|
:value="scope.row.isDeleted"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<!-- <el-table-column
|
||||||
|
label="备注"
|
||||||
|
align="center"
|
||||||
|
prop="remark"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template #default="scope">
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['business:article:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['business:article:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- ---------------------这里是新增和更新的对话框--------------------- -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||||
|
<el-form ref="dataRef" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="供应商编码" prop="code">
|
||||||
|
<el-input v-model="form.code" placeholder="请输入供应商编码" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="供应商名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入供应商名称" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="地址" prop="address">
|
||||||
|
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="供应商编码" prop="code">
|
||||||
|
<el-input v-model="form.code" placeholder="请输入供应商编码" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="联系电话" prop="phone">
|
||||||
|
<el-input v-model="form.phone" placeholder="请输入联系电话" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="传真" prop="fax">
|
||||||
|
<el-input v-model="form.fax" placeholder="请输入传真" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="邮箱" prop="email">
|
||||||
|
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||||
|
<el-radio-group v-model="form.isDeleted">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="JSON.parse(dict.value)"
|
||||||
|
>{{ dict.label }}</el-radio
|
||||||
|
>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="备注" prop="remarks">
|
||||||
|
<el-input
|
||||||
|
v-model="form.remarks"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
listData,
|
||||||
|
getData,
|
||||||
|
delData,
|
||||||
|
addData,
|
||||||
|
updateData,
|
||||||
|
} from "@/api/erp/supplierApi";
|
||||||
|
import { ref } from "@vue/reactivity";
|
||||||
|
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||||
|
|
||||||
|
const dataList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const title = ref("");
|
||||||
|
const dateRange = ref([]);
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: undefined,
|
||||||
|
code: undefined,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
code: [{ required: true, message: "供应商编号不能为空", trigger: "blur" }],
|
||||||
|
name: [{ required: true, message: "供应商名称不能为空", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
listData(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||||
|
(response) => {
|
||||||
|
dataList.value = response.data.data;
|
||||||
|
total.value = response.data.total;
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/** 取消按钮 */
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** 表单重置 */
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
id: undefined,
|
||||||
|
title: undefined,
|
||||||
|
isDeleted: false,
|
||||||
|
remark: undefined,
|
||||||
|
};
|
||||||
|
proxy.resetForm("dataRef");
|
||||||
|
}
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
dateRange.value = [];
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加供应商";
|
||||||
|
}
|
||||||
|
/** 多选框选中数据 */
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map((item) => item.id);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
const id = row.id || ids.value;
|
||||||
|
getData(id).then((response) => {
|
||||||
|
form.value = response.data;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改供应商";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["dataRef"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (form.value.id != undefined) {
|
||||||
|
updateData(form.value.id,form.value).then((response) => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addData(form.value).then((response) => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const delIds = row.id || ids.value;
|
||||||
|
proxy.$modal
|
||||||
|
.confirm('是否确认删除字典编号为"' + delIds + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
|
return delData(delIds);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user