修改代码生成测试代码
This commit is contained in:
parent
fdd7fea4c6
commit
e4487c9f56
@ -22,7 +22,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// 代码生成演示Controller
|
/// 代码生成演示Controller
|
||||||
///
|
///
|
||||||
/// @author zr
|
/// @author zr
|
||||||
/// @date 2021-10-10
|
/// @date 2021-11-24
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Verify]
|
[Verify]
|
||||||
[Route("business/Gendemo")]
|
[Route("business/Gendemo")]
|
||||||
@ -49,9 +49,9 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
//开始拼装查询条件
|
//开始拼装查询条件
|
||||||
var predicate = Expressionable.Create<Gendemo>();
|
var predicate = Expressionable.Create<Gendemo>();
|
||||||
|
|
||||||
//TODO 搜索条件
|
//TODO 自己实现搜索条件查询语法参考Sqlsugar,默认查询所有
|
||||||
//predicate = predicate.And(m => m.Name.Contains(parm.Name));
|
//predicate = predicate.And(m => m.Name.Contains(parm.Name));
|
||||||
_GendemoService.Test();
|
|
||||||
var response = _GendemoService.GetPages(predicate.ToExpression(), parm);
|
var response = _GendemoService.GetPages(predicate.ToExpression(), parm);
|
||||||
|
|
||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
@ -77,7 +77,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ActionPermissionFilter(Permission = "business:gendemo:add")]
|
[ActionPermissionFilter(Permission = "business:gendemo:add")]
|
||||||
[Log(Title = "代码生成演示添加", BusinessType = BusinessType.INSERT)]
|
[Log(Title = "代码生成演示", BusinessType = BusinessType.INSERT)]
|
||||||
public IActionResult AddGendemo([FromBody] GendemoDto parm)
|
public IActionResult AddGendemo([FromBody] GendemoDto parm)
|
||||||
{
|
{
|
||||||
if (parm == null)
|
if (parm == null)
|
||||||
@ -92,8 +92,12 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
it.Name,
|
it.Name,
|
||||||
it.Icon,
|
it.Icon,
|
||||||
it.ShowStatus,
|
it.ShowStatus,
|
||||||
|
it.AddTime,
|
||||||
it.Sex,
|
it.Sex,
|
||||||
it.Sort,
|
it.Sort,
|
||||||
|
it.BeginTime,
|
||||||
|
it.EndTime,
|
||||||
|
it.Remark,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +107,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
[ActionPermissionFilter(Permission = "business:gendemo:update")]
|
[ActionPermissionFilter(Permission = "business:gendemo:update")]
|
||||||
[Log(Title = "代码生成演示修改", BusinessType = BusinessType.UPDATE)]
|
[Log(Title = "代码生成演示", BusinessType = BusinessType.UPDATE)]
|
||||||
public IActionResult UpdateGendemo([FromBody] GendemoDto parm)
|
public IActionResult UpdateGendemo([FromBody] GendemoDto parm)
|
||||||
{
|
{
|
||||||
if (parm == null)
|
if (parm == null)
|
||||||
@ -119,8 +123,12 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Icon = model.Icon,
|
Icon = model.Icon,
|
||||||
ShowStatus = model.ShowStatus,
|
ShowStatus = model.ShowStatus,
|
||||||
|
AddTime = model.AddTime,
|
||||||
Sex = model.Sex,
|
Sex = model.Sex,
|
||||||
Sort = model.Sort,
|
Sort = model.Sort,
|
||||||
|
BeginTime = model.BeginTime,
|
||||||
|
EndTime = model.EndTime,
|
||||||
|
Remark = model.Remark,
|
||||||
});
|
});
|
||||||
|
|
||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
@ -132,7 +140,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpDelete("{ids}")]
|
[HttpDelete("{ids}")]
|
||||||
[ActionPermissionFilter(Permission = "business:gendemo:delete")]
|
[ActionPermissionFilter(Permission = "business:gendemo:delete")]
|
||||||
[Log(Title = "代码生成演示删除", BusinessType = BusinessType.DELETE)]
|
[Log(Title = "代码生成演示", BusinessType = BusinessType.DELETE)]
|
||||||
public IActionResult DeleteGendemo(string ids)
|
public IActionResult DeleteGendemo(string ids)
|
||||||
{
|
{
|
||||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||||
|
|||||||
@ -16,6 +16,9 @@ namespace ZR.Model.Dto
|
|||||||
public int ShowStatus { get; set; }
|
public int ShowStatus { get; set; }
|
||||||
public int? Sex { get; set; }
|
public int? Sex { get; set; }
|
||||||
public int? Sort { get; set; }
|
public int? Sort { get; set; }
|
||||||
|
public DateTime? BeginTime { get; set; }
|
||||||
|
public DateTime? EndTime { get; set; }
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +27,6 @@ namespace ZR.Model.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class GendemoQueryDto: PagerInfo
|
public class GendemoQueryDto: PagerInfo
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public DateTime? BeginTime { get; set; }
|
public DateTime? BeginTime { get; set; }
|
||||||
public DateTime? EndTime { get; set; }
|
public DateTime? EndTime { get; set; }
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace ZR.Model.Models
|
|||||||
/// 代码生成演示,数据实体对象
|
/// 代码生成演示,数据实体对象
|
||||||
///
|
///
|
||||||
/// @author zr
|
/// @author zr
|
||||||
/// @date 2021-09-27
|
/// @date 2021-11-24
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SqlSugar.SugarTable("gen_demo")]
|
[SqlSugar.SugarTable("gen_demo")]
|
||||||
public class Gendemo
|
public class Gendemo
|
||||||
@ -16,11 +16,11 @@ namespace ZR.Model.Models
|
|||||||
/// 描述 :自增id
|
/// 描述 :自增id
|
||||||
/// 空值 :False
|
/// 空值 :False
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
[SqlSugar.SugarColumn(IsPrimaryKey = false, IsIdentity = true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述 :名称
|
/// 描述 :名称
|
||||||
/// 空值 :False
|
/// 空值 :True
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -48,6 +48,21 @@ namespace ZR.Model.Models
|
|||||||
/// 空值 :True
|
/// 空值 :True
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? Sort { get; set; }
|
public int? Sort { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :开始时间
|
||||||
|
/// 空值 :True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? BeginTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :结束时间
|
||||||
|
/// 空值 :True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? EndTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :备注
|
||||||
|
/// 空值 :True
|
||||||
|
/// </summary>
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,6 @@ using System;
|
|||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
using ZR.Repository.System;
|
using ZR.Repository.System;
|
||||||
using ZR.Model.Models;
|
using ZR.Model.Models;
|
||||||
using SqlSugar;
|
|
||||||
using SqlSugar.IOC;
|
|
||||||
|
|
||||||
namespace ZR.Repository
|
namespace ZR.Repository
|
||||||
{
|
{
|
||||||
@ -11,22 +9,12 @@ namespace ZR.Repository
|
|||||||
/// 代码生成演示仓储接口的实现
|
/// 代码生成演示仓储接口的实现
|
||||||
///
|
///
|
||||||
/// @author zr
|
/// @author zr
|
||||||
/// @date 2021-09-27
|
/// @date 2021-11-24
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||||
public class GendemoRepository : BaseRepository<Gendemo>
|
public class GendemoRepository : BaseRepository<Gendemo>
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarClient db;
|
|
||||||
public GendemoRepository()
|
|
||||||
{
|
|
||||||
db = DbScoped.SugarScope.GetConnection(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region 业务逻辑代码
|
#region 业务逻辑代码
|
||||||
public void Test()
|
|
||||||
{
|
|
||||||
var date = db.GetDate();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,5 @@
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
using Infrastructure.Extensions;
|
|
||||||
using SqlSugar;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using ZR.Common;
|
|
||||||
using ZR.Model.Models;
|
using ZR.Model.Models;
|
||||||
using ZR.Repository;
|
using ZR.Repository;
|
||||||
|
|
||||||
@ -16,22 +9,19 @@ namespace ZR.Service.Business
|
|||||||
/// 代码生成演示Service业务层处理
|
/// 代码生成演示Service业务层处理
|
||||||
///
|
///
|
||||||
/// @author zr
|
/// @author zr
|
||||||
/// @date 2021-09-27
|
/// @date 2021-11-24
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AppService(ServiceType = typeof(IGendemoService), ServiceLifetime = LifeTime.Transient)]
|
[AppService(ServiceType = typeof(IGendemoService), ServiceLifetime = LifeTime.Transient)]
|
||||||
public class GendemoService: BaseService<Gendemo>, IGendemoService
|
public class GendemoService: BaseService<Gendemo>, IGendemoService
|
||||||
{
|
{
|
||||||
private readonly GendemoRepository _repository;
|
private readonly GendemoRepository _Gendemorepository;
|
||||||
public GendemoService(GendemoRepository repository)
|
public GendemoService(GendemoRepository repository)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_Gendemorepository = repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 业务逻辑代码
|
#region 业务逻辑代码
|
||||||
public void Test()
|
|
||||||
{
|
|
||||||
_repository.Test();
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,10 +7,9 @@ namespace ZR.Service.Business
|
|||||||
/// 代码生成演示service接口
|
/// 代码生成演示service接口
|
||||||
///
|
///
|
||||||
/// @author zr
|
/// @author zr
|
||||||
/// @date 2021-09-27
|
/// @date 2021-11-24
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGendemoService: IBaseService<Gendemo>
|
public interface IGendemoService: IBaseService<Gendemo>
|
||||||
{
|
{
|
||||||
void Test();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,6 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||||
<el-form-item label="名称" :label-width="labelWidth">
|
|
||||||
<el-input v-model="queryParams.name" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="时间">
|
|
||||||
<el-date-picker v-model="timeRange" size="small" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-row class="mb8" style="text-align:center">
|
<el-row class="mb8" style="text-align:center">
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
@ -30,24 +24,28 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 数据区域 -->
|
<!-- 数据区域 -->
|
||||||
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
<el-table :data="dataList" ref="table" border @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="50" />
|
<el-table-column type="selection" width="50" />
|
||||||
<el-table-column prop="id" label="自增id" align="center" />
|
<el-table-column prop="id" label="自增id" align="center" />
|
||||||
<el-table-column prop="name" label="名称" align="center" :show-overflow-tooltip="true" />
|
<el-table-column prop="name" label="名称" align="center" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column prop="icon" label="图片">
|
<el-table-column prop="icon" label="图片">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-image class="table-td-thumb" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"></el-image>
|
<el-image class="table-td-thumb" :src="scope.row.icon" :preview-src-list="[scope.row.icon]"></el-image>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="showStatus" label="显示状态" align="center" :formatter="showStatusFormat" />
|
<el-table-column prop="showStatus" label="显示状态" align="center" :formatter="showStatusFormat"/>
|
||||||
<el-table-column prop="sex" label="用户性别" align="center" :formatter="sexFormat" />
|
<el-table-column prop="addTime" label="添加时间" align="center" />
|
||||||
|
<el-table-column prop="sex" label="用户性别" align="center" :formatter="sexFormat"/>
|
||||||
<el-table-column prop="sort" label="排序" align="center" />
|
<el-table-column prop="sort" label="排序" align="center" />
|
||||||
|
<el-table-column prop="beginTime" label="开始时间" align="center" />
|
||||||
|
<el-table-column prop="endTime" label="结束时间" align="center" />
|
||||||
|
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
|
||||||
<el-table-column label="操作" align="center" width="200">
|
<el-table-column label="操作" align="center" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button v-hasPermi="['business:gendemo:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
<el-button v-hasPermi="['business:gendemo:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
<el-popconfirm title="确定删除吗?" @confirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||||
<el-button slot="reference" v-hasPermi="['business:gendemo:delete']" type="text" icon="el-icon-delete">删除</el-button>
|
<el-button slot="reference" v-hasPermi="['business:gendemo:delete']" type="text" icon="el-icon-delete">删除</el-button>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -55,32 +53,40 @@
|
|||||||
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改菜单对话框 -->
|
<!-- 添加或修改菜单对话框 -->
|
||||||
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open">
|
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" >
|
||||||
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
||||||
<el-form-item label="名称" :label-width="labelWidth" prop="name">
|
<el-form-item label="名称" :label-width="labelWidth" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="图片" :label-width="labelWidth" prop="icon">
|
<el-form-item label="图片" :label-width="labelWidth" prop="icon">
|
||||||
<el-upload class="avatar-uploader" name="file" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleUploadIconSuccess" :before-upload="beforeFileUpload">
|
<el-upload class="avatar-uploader" name="file" action="/api/upload/saveFile/" :show-file-list="false" :on-success="handleUploadIconSuccess" :before-upload="beforeFileUpload">
|
||||||
<img v-if="form.icon" :src="form.icon" class="icon">
|
<img v-if="form.icon" :src="form.icon" class="icon">
|
||||||
<i v-else class="el-icon-plus uploader-icon"></i>
|
<i v-else class="el-icon-plus uploader-icon"></i>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-input v-model="form.icon" placeholder="请上传文件或手动输入文件地址"></el-input>
|
<el-input v-model="form.icon" placeholder="请上传文件或手动输入文件地址"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示状态" :label-width="labelWidth" prop="showStatus">
|
<el-form-item label="显示状态" :label-width="labelWidth" prop="showStatus">
|
||||||
<el-radio-group v-model="form.showStatus">
|
<el-select v-model="form.showStatus">
|
||||||
<el-radio :key="1" :label="1">是</el-radio>
|
<el-option v-for="item in showStatusOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||||
<el-radio :key="0" :label="0">否</el-radio>
|
</el-select>
|
||||||
</el-radio-group>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="用户性别" :label-width="labelWidth" prop="sex">
|
||||||
<el-form-item label="用户性别" :label-width="labelWidth" prop="sex">
|
<el-select v-model="form.sex">
|
||||||
<el-select v-model="form.sex">
|
<el-option v-for="item in sexOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
||||||
<el-option v-for="item in sexOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
</el-select>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="排序" :label-width="labelWidth" prop="sort">
|
||||||
<el-form-item label="排序" :label-width="labelWidth" prop="sort">
|
<el-input-number v-model.number="form.sort" placeholder="请输入排序" />
|
||||||
<el-input v-model.number="form.sort" placeholder="请输入排序" />
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="开始时间" :label-width="labelWidth" prop="beginTime">
|
||||||
|
<el-date-picker v-model="form.beginTime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"> </el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束时间" :label-width="labelWidth" prop="endTime">
|
||||||
|
<el-date-picker v-model="form.endTime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"> </el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" :label-width="labelWidth" prop="remark">
|
||||||
|
<editor v-model="form.remark" :min-height="200" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||||
@ -97,15 +103,19 @@ import {
|
|||||||
addGendemo,
|
addGendemo,
|
||||||
delGendemo,
|
delGendemo,
|
||||||
updateGendemo,
|
updateGendemo,
|
||||||
getGendemo,
|
getGendemo
|
||||||
} from "@/api/gendemo.js";
|
} from '@/api/gendemo.js';
|
||||||
|
|
||||||
|
import Editor from '@/components/Editor';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Gendemo",
|
name: 'Gendemo',
|
||||||
|
components: { Editor },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
labelWidth: "100px",
|
labelWidth: "100px",
|
||||||
formLabelWidth: "100px",
|
formLabelWidth:"100px",
|
||||||
// 选中id数组
|
// 选中id数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
@ -126,7 +136,7 @@ export default {
|
|||||||
form: {},
|
form: {},
|
||||||
// 时间范围数组
|
// 时间范围数组
|
||||||
timeRange: [],
|
timeRange: [],
|
||||||
// 显示状态选项列表
|
// 显示状态选项列表
|
||||||
showStatusOptions: [],
|
showStatusOptions: [],
|
||||||
// 用户性别选项列表
|
// 用户性别选项列表
|
||||||
sexOptions: [],
|
sexOptions: [],
|
||||||
@ -139,11 +149,9 @@ export default {
|
|||||||
btnSubmitVisible: true,
|
btnSubmitVisible: true,
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
id: [{ type: "number", message: "id必须为数字值", trigger: "blur" }],
|
id: [{ type: 'number', message: 'id必须为数字值', trigger: "blur"}],
|
||||||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
showStatus: [{ required: true, message: '请输入显示状态', trigger: "blur"}],
|
||||||
showStatus: [
|
|
||||||
{ required: true, message: "请输入显示状态", trigger: "blur" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -151,25 +159,24 @@ export default {
|
|||||||
// 列表数据查询
|
// 列表数据查询
|
||||||
this.getList();
|
this.getList();
|
||||||
|
|
||||||
this.getDicts("sys_normal_disable").then((response) => {
|
this.getDicts("sys_show_hide").then((response) => {
|
||||||
this.showStatusOptions = response.data;
|
this.showStatusOptions = response.data;
|
||||||
});
|
})
|
||||||
this.getDicts("sys_user_sex").then((response) => {
|
this.getDicts("sys_user_sex").then((response) => {
|
||||||
this.sexOptions = response.data;
|
this.sexOptions = response.data;
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 查询数据
|
// 查询数据
|
||||||
getList() {
|
getList() {
|
||||||
console.log(JSON.stringify(this.queryParams));
|
console.log(JSON.stringify(this.queryParams));
|
||||||
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(
|
listGendemo(this.addDateRange(this.queryParams, this.timeRange)).then(res => {
|
||||||
(res) => {
|
if (res.code == 200) {
|
||||||
if (res.code == 200) {
|
this.dataList = res.data.result;
|
||||||
this.dataList = res.data.result;
|
this.total = res.data.totalCount;
|
||||||
this.total = res.data.totalCount;
|
}
|
||||||
}
|
})
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -182,9 +189,14 @@ export default {
|
|||||||
name: undefined,
|
name: undefined,
|
||||||
icon: undefined,
|
icon: undefined,
|
||||||
showStatus: undefined,
|
showStatus: undefined,
|
||||||
|
addTime: undefined,
|
||||||
sex: undefined,
|
sex: undefined,
|
||||||
sort: undefined,
|
sort: undefined,
|
||||||
//TODO 根据实际内容调整
|
beginTime: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
|
||||||
|
//TODO 根据实际内容调整
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -202,7 +214,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map((item) => item.id);
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length != 1;
|
this.single = selection.length!=1
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@ -228,15 +240,15 @@ export default {
|
|||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids;
|
const id = row.id || this.ids;
|
||||||
getGendemo(id).then((res) => {
|
getGendemo(id).then((res) => {
|
||||||
if (res.code == 200) {
|
if(res.code == 200){
|
||||||
this.form = res.data;
|
this.form = res.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改数据";
|
this.title = "修改数据";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeFileUpload(file) {},
|
beforeFileUpload(file) { },
|
||||||
//文件上传成功方法
|
//文件上传成功方法
|
||||||
handleUploadIconSuccess(res, file) {
|
handleUploadIconSuccess(res, file) {
|
||||||
this.form.icon = URL.createObjectURL(file.raw);
|
this.form.icon = URL.createObjectURL(file.raw);
|
||||||
// this.$refs.upload.clearFiles();
|
// this.$refs.upload.clearFiles();
|
||||||
@ -256,17 +268,17 @@ export default {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(JSON.stringify(this.form));
|
console.log(JSON.stringify(this.form));
|
||||||
|
|
||||||
if (this.form.id != undefined || this.title === "修改数据") {
|
if (this.form.id != undefined || this.title === '修改数据') {
|
||||||
updateGendemo(this.form).then((res) => {
|
updateGendemo(this.form).then((res) => {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addGendemo(this.form).then((res) => {
|
addGendemo(this.form).then((res) => {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user