当前位置: 首页 > news >正文

elementUI2

ElementUI

    • 图片引用
    • 查询表单
    • 表格展示
    • 新增修改
    • 详情
    • 图表

图片引用

	<img :src="logo" width="100%" height="100%"/>import logoImg from '@/assets/logo/home.png'data() {return {logo: logoImg,}}

查询表单

<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"><el-form-item label="姓名" prop="name"><el-inputv-model="queryParams.name"placeholder="请输入姓名"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="出生日期" prop="dateOfBirth"><el-date-picker clearablev-model="queryParams.dateOfBirth"type="date"value-format="yyyy-MM-dd":picker-options="pickerOptions"placeholder="请选择出生日期"></el-date-picker></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>import { listInformation, getInformation, delInformation, addInformation, updateInformation } from "@/api/system/information";
export default {data() {return {pickerOptions: {disabledDate(time) {return time.getTime() > Date.now();},},// 遮罩层loading: true,// 总条数total: 0,// 信息表格数据informationList: [],// 查询参数queryParams: {pageNum: 1,pageSize: 10,name: null,dateOfBirth: null,},}methods: {/** 重置按钮操作 */resetQuery() {this.resetForm("queryForm");this.handleQuery();},/** 搜索按钮操作 */handleQuery() {this.queryParams.pageNum = 1;this.getList();},/** 查询信息列表 */getList() {this.loading = true;listInformation(this.queryParams).then(response => {this.informationList = response.rows;this.total = response.total;this.loading = false;});},}
} 

表格展示

// 表格上面的按钮
<el-row :gutter="10" class="mb8"><el-col :span="1.5"><el-buttontype="primary"plainicon="el-icon-plus"size="mini"@click="handleAdd"v-hasPermi="['system:information:add']">新增</el-button></el-col><el-col :span="1.5"><el-buttontype="danger"plainicon="el-icon-delete"size="mini":disabled="multiple"@click="handleDelete"v-hasPermi="['system:information:remove']">删除</el-button></el-col><el-col :span="1.5"><el-buttontype="warning"plainicon="el-icon-download"size="mini"@click="handleExport"v-hasPermi="['system:information:export']">导出</el-button></el-col><right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row><el-table v-loading="loading" :data="informationList" @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="name" /><el-table-column label="性别" align="center" prop="sex" ><template slot-scope="scope"><dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex ? scope.row.sex.split(',') : []"/></template></el-table-column><el-table-column label="审核状态" align="center" prop="status" v-if="user.userName!='admin' "><template slot-scope="scope"><dict-tag :options="dict.type.info_status" :value="scope.row.status ? scope.row.status.split(',') : []"/></template></el-table-column><el-table-column label="操作" align="center"  fixed="right" class-name="small-padding fixed-width"  width="240px"><template slot-scope="scope"><span v-if="user.userName=='admin' "><el-buttonsize="mini"type="text"@click="updateStatus(scope.row)"v-hasPermi="['system:information:edit']">审批</el-button><el-buttonsize="mini"type="text"@click="cancelStatus(scope.row)"v-hasPermi="['system:information:edit']">取消审批</el-button><el-buttonsize="mini"type="text"@click="handleView(scope.row)"v-hasPermi="['system:information:edit']">查看详情</el-button><br/></span><el-buttonsize="mini"type="text"icon="el-icon-edit"@click="handleUpdate(scope.row)"v-hasPermi="['system:information:edit']"style="margin-left: 10px;">修改</el-button><el-buttonsize="mini"type="text"icon="el-icon-delete"@click="handleDelete(scope.row)"v-hasPermi="['system:information:remove']">删除</el-button></template></el-table-column>
</el-table>
<paginationv-show="total>0":total="total":page.sync="queryParams.pageNum":limit.sync="queryParams.pageSize"@pagination="getList"/>
import { selectDictLabel} from '@/main.js'
import { listInformation, getInformation, delInformation, addInformation, updateInformation } from "@/api/system/information";
export default {// 数据字典(这个是若依封装好的)dicts: ['sys_user_sex'],data() {},created() {this.getList();this.getUser();this.getDeptTree();},methods: {// 多选框选中数据handleSelectionChange(selection) {this.ids = selection.map(item => item.id)this.single = selection.length!==1this.multiple = !selection.length},/** 新增按钮操作 */handleAdd() {this.reset();this.open = true;this.title = "添加档案基本信息";},/** 导出按钮操作 */handleExport() {this.download('system/information/export', {...this.queryParams}, `information_${new Date().getTime()}.xlsx`)}//审批按钮(确认弹框)updateStatus(row){//根据 row所选中的数据,传入获取ID,调用修改方法修改数据状态const id = row.id || this.idsthis.$modal.confirm('是否确认审批档案基本信息编号为"' + id + '"的数据项?').then(function() {row.status="1";return updateInformation(row);}).then(() => {this.getList();this.$modal.msgSuccess("审批成功");}).catch(() => {});},//取消审批(确认弹框,需填入信息)cancelStatus(row){const id = row.id || this.idsthis.$prompt('请输入档案基本信息编号为"' + id + '"取消审批的原因:', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',}).then(({ value }) => {row.status = "2";row.rmk = value;updateInformation(row);this.getList();this.$modal.msgSuccess("取消成功");}).catch(() => {});},/** 详情按钮操作 */handleView(row){this.reset();const id = row.id || this.idsgetInformation(id).then(response => {this.form = response.data;this.openDetail = true;});},/** 修改按钮操作 */handleUpdate(row) {this.reset();const id = row.id || this.idsgetInformation(id).then(response => {this.form = response.data;this.open = true;this.title = "修改档案基本信息";});},/** 删除按钮操作 */handleDelete(row) {const ids = row.id || this.ids;this.$modal.confirm('是否确认删除档案基本信息编号为"' + ids + '"的数据项?').then(function() {return delInformation(ids);}).then(() => {this.getList();this.$modal.msgSuccess("删除成功");}).catch(() => {});},// 表单重置reset() {this.form = {id: null,name: null,sex: null,。。。};this.resetForm("form");},}

新增修改

<!-- 添加或修改档案基本信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1500px" append-to-body><el-form ref="form" :model="form" :rules="rules" label-width="160px"><el-tabs v-model="activeName" @tab-click="handleClick"><el-tab-pane label="基础身份信息" name="first"><el-row><el-col :span="6"><el-form-item label="姓名" prop="name"><el-input v-model="form.name" placeholder="请输入姓名" /></el-form-item></el-col><el-col :span="6"><el-form-item label="性别" prop="sex"><el-select v-model="form.sex" placeholder="请选择"><el-optionv-for="dict in dict.type.sys_user_sex":key="dict.value":label="dict.label":value="dict.value"></el-option></el-select></el-form-item></el-col><el-col :span="6"><el-form-item label="联系电话" prop="phone"><el-input v-model="form.phone" placeholder="请输入联系电话" /></el-form-item></el-col><el-col :span="6"><el-form-item label="出生日期" prop="dateOfBirth"><el-date-picker clearablev-model="form.dateOfBirth"type="date"value-format="yyyy-MM-dd":picker-options="pickerOptions"placeholder="请选择出生日期"></el-date-picker></el-form-item></el-col></el-row></el-tab-pane><el-tab-pane label="组织生活、社会活动信息" name="second"><el-row><el-col :span="24"><el-form-item label="身份证号" prop="idCard"><el-input v-model="form.idCard" placeholder="请输入身份证号" /></el-form-item></el-col></el-row></el-tab-pane></el-tabs></el-form><div slot="footer" class="dialog-footer"><el-button type="primary" @click="submitForm">确 定</el-button><el-button @click="cancel">取 消</el-button></div>
</el-dialog>
import { deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {name: "Information",dicts: ['sys_info_marital_status', 。。。],components: { Treeselect },data() {var isCardId = (rule, value, callback) => {if (!value) {return new Error("请输入身份证号)");} else {const reg =/^[1-9]\d{5}(18|19|20|21|22|23|24)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;const card = reg.test(value);if (!card) { callback(new Error("身份证号格式有误!"));} else {callback();}}};//手机号格式校验var validatorPhone = function (rule, value, callback) {if (value === '') {callback(new Error('手机号不能为空'))} else if (!/^1\d{10}$/.test(value)) {callback(new Error('手机号格式错误'))} else {callback()}}return {// 表单校验rules: {name: [{ required: true, message: '请输入姓名', trigger: 'blur' },{ min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur' }],sex: [{ required: true, message: '请选择性别', trigger: 'change' }],dateOfBirth: [{ type: 'string', required: true, message: '请选择出生日期', trigger: 'change' }],idCard: [{ required: true, message: '请输入身份证号', trigger: 'blur' },{ validator: isCardId, message: '身份证号格式有误', trigger: "blur" }],phone: [{ required: true, message: '请输入联系电话', trigger: 'blur' },{ validator: validatorPhone, message: '联系电话格式有误', trigger: "blur" }],}},methods: {// 取消按钮cancel() {this.open = false;this.reset();},/** 提交按钮 */submitForm() {this.$refs["form"].validate(valid => {if (valid) {if (this.form.id != null) {updateInformation(this.form).then(response => {this.$modal.msgSuccess("修改成功");this.open = false;this.getList();});} else {addInformation(this.form).then(response => {this.$modal.msgSuccess("新增成功");this.open = false;this.getList();});}} else {this.$message({message: '请将必填信息填写完整!!',type: 'warning'});}});},}

详情

<!-- 信息详细 -->
<el-dialog title="信息详细" :visible.sync="openDetail" width="1000px" append-to-body><el-form ref="form" :model="form" label-width="160px" size="mini"><dev style="margin-bottom: 20px;font-size: 18px; " ><b style="margin-left: 450px;">基础信息</b></dev><el-row style="margin-top: 20px;"><el-col :span="6"><el-form-item label="姓名:">{{ form.name }}</el-form-item></el-col><el-col :span="6"><el-form-item label="民族:">{{ form.ethnicGroup }}</el-form-item></el-col><el-col :span="6"><el-form-item label="出生日期:">{{ form.dateOfBirth }}</el-form-item></el-col><el-col :span="12"><el-form-item label="户籍类别:">{{ selectDictLabel(dict.type.type_status,form.type) }}</el-form-item></el-col></el-row><dev style="margin-bottom: 20px;font-size: 18px;"><b style="margin-left: 400px;">组织生活、社会活动信息</b></dev><el-row style="margin-top: 20px;"><el-col :span="12"><el-form-item label="所在党支部:">{{ form.partyBranch }}</el-form-item></el-col><el-col :span="12"><el-form-item label="社会职务:">{{ selectDictLabel(dict.type.sys_socialduty,form.socialDuty) }}</el-form-item></el-col></el-form><div slot="footer" class="dialog-footer"><el-button @click="openDetail = false">关 闭</el-button></div>
</el-dialog>

图表

<div><el-row style="margin-top: 40px;margin-left: 30px;"><el-col  :span="12"><div ref="chart" style="width: 600px; height: 400px;"></div></el-col>。。。</el-row>
</div>import { listInformation2 } from "@/api/system/table";
import * as echarts  from 'echarts';
export default {name: "Table",data() {return {dataEchars1:[],dataEchars2:[],dataEchars3:[],dataEchars4:[],};},created() {this.getList2();},methods: {getList2() {listInformation2().then(response => {// 学历/学位/户籍类别//审批状态this.dataEchars1=response[0].rows;。。。this.initechars();  });},initechars(){// 基于准备好的dom,初始化echarts实例let myChart = echarts.init(this.$refs.chart);// 指定图表的配置项和数据let  option = {title: {text: '学历状态统计',subtext: '全部档案',left: 'center'},tooltip: {trigger: 'item'},legend: {orient: 'vertical',left: 'left'},series: [{name: '学历状态统计图',type: 'pie',radius: '50%',data: this.dataEchars1,emphasis: {itemStyle: {shadowBlur: 10,shadowOffsetX: 0,shadowColor: 'rgba(0, 0, 0, 0.5)'}}}]};// 使用刚指定的配置项和数据显示图表myChart.setOption(option);。。。。},}
};
@PreAuthorize("@ss.hasPermi('system:table:query')")
@GetMapping("/list1")
public List<TableDataInfo> list1(SoldierInformation soldierInformation) {List<Long> Null;List<SoldierInformation> list = soldierInformationService.selectAllSoldierInformationList();//设置初始化Echars图表数据集合List<PieChart> pieChart1 = new ArrayList<PieChart>();List<PieChart> pieChart2 = new ArrayList<PieChart>();。。。//判断表中数据不能为空if (list.size() > 0) {//学历情况int qualification1 = 0;//博士研究生int qualification2 = 0;//硕士研究生。。。//学位情况int education1 = 0;//博士int education2 = 0;//硕士。。。if (list.size() > 0) {for (int i = 0; i < list.size(); i++) {//计算学历情况if (("0").equals(list.get(i).getEducation())) {qualification1 += 1;} else if (("1").equals(list.get(i).getEducation())) {qualification2 += 1;} else if (("2").equals(list.get(i).getEducation())) {qualification3 += 1;} else 。。。//计算学位情况if (("0").equals(list.get(i).getEducation1())) {education1 += 1;} else if (("1").equals(list.get(i).getEducation1())) {education2 += 1;} else。。。}//学位情况pieChart1.add(new PieChart("博士研究生", qualification1));pieChart1.add(new PieChart("硕士研究生", qualification2));。。。//学位情况pieChart2.add(new PieChart("博士", education1));pieChart2.add(new PieChart("硕士", education2));。。。}}TableDataInfo tableDataInfo1 = getDataTable(pieChart1);TableDataInfo tableDataInfo2 = getDataTable(pieChart2);。。。List<TableDataInfo> resultList =  new ArrayList<>();resultList.add(tableDataInfo1);resultList.add(tableDataInfo2);。。。return resultList;
}
http://www.lryc.cn/news/337189.html

相关文章:

  • Python 爬虫基础——http请求和http响应
  • 【Hadoop】Hive导入导出数据指南
  • Mybatis 执行批量插入
  • vivado 使用基本触发器模式
  • Chrome 浏览器无法保存或自动填充密码
  • C语言面试指针辨析
  • YOLOV5 分类:利用yolov5进行图像分类
  • Golang | Leetcode Golang题解之第16题最接近的三数之和
  • React添加到现有项目
  • java 邮件发送表格
  • 鸿蒙ArkTS小短剧开源项目进行中
  • Go 项目依赖注入wire工具最佳实践介绍与使用
  • 地推网推拉新致富是真的吗?靠谱平台揭秘
  • VTK使用交互器来从三维体数据中提取二维切片
  • NCBI 数据下载
  • 【Rust】基础语法
  • JVM基础:类的生命周期详解
  • 【Canvas技法】在Canvas按圆周绘制图形或是标注文字时,角度累加的方向为顺时针,起点为x轴正向
  • 计算机网络-TCP断开连接阶段错误应对机制
  • springboot动态使用DruidDataSource切换数据源(动态配置多个数据源)
  • P8786 [蓝桥杯 2022 省 B] 李白打酒加强版
  • 没有网没有移动存储的情况下两台电脑如何互相传输数据
  • 如何用putty通过ssh连接ubuntu
  • java如何实现rabbitmq的消息确认机制和消息持久化机制配置和示例
  • react 组件:Suspense
  • 2024-4-5修改vscode的代理
  • python字符切片的规则
  • C++ 的内存安全与效率
  • Go 实战|使用 Wails 构建轻量级的桌面应用:仿微信登录界面 Demo
  • c++取经之路(其五)——类和对象拷贝构造函数