验收通过了,因为要赶车所以当场学习能力大爆发了,成功验收,也成功赶上了车。
Control层
package com.cxk.baseframe.project.systemmanage.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import com.cxk.baseframe.config.common.annotation.Log;
import com.cxk.baseframe.config.common.entity.common.domain.AjaxResult;
import com.cxk.baseframe.config.common.entity.common.domain.page.TableDataInfo;
import com.cxk.baseframe.config.common.entity.systemmanage.system.Policy;
import com.cxk.baseframe.config.common.enums.BusinessType;
import com.cxk.baseframe.config.common.response.BaseController;
import com.cxk.baseframe.config.common.utils.MapUtil;
import com.cxk.baseframe.config.common.utils.poi.ExcelUtil;
import com.cxk.baseframe.project.systemmanage.service.IPolicyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
/**
* 科技文档Controller
*
* @author cxk
* @date 2024-04-30
*/
@Api(tags={"科技文档管理"})
@RestController
@RequestMapping("/system-manage-service/system/policy")
public class PolicyController extends BaseController
{
@Resource
private IPolicyService policyService;
/**
* 查询科技文档列表
*/
@ApiOperation(value="查询科技文档列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "policy", value = "科技文档实体", dataType = "Policy", required = false),
@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", defaultValue = "1", required = false),
@ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", defaultValue = "10", required = false)
})
@GetMapping("/list")
public TableDataInfo list(Policy policy)
{
startPage();
List<Policy> list = policyService.selectPolicyList(policy);
return getDataTable(list);
}
/**
* 导出科技文档列表
*/
@ApiOperation(value="导出科技文档列表")
@ApiImplicitParam(name = "policy", value = "科技文档实体", dataType = "Policy", required = false)
@Log(title = "科技文档", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Policy policy)
{
List<Policy> list = policyService.selectPolicyList(policy);
ExcelUtil<Policy> util = new ExcelUtil(Policy.class);
util.exportExcel(response, list, "科技文档数据");
}
/**
* 获取科技文档详细信息
*/
@ApiOperation(value="获取科技文档详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "科技文档Id", dataType = "String", paramType = "query", required = true)
})
@GetMapping(value = "/getInfo")
public AjaxResult getInfo(@RequestParam String id)
{
return success(policyService.selectPolicyById(id));
}
/**
* 新增科技文档
*/
@ApiOperation(value="新增科技文档")
@ApiImplicitParam(name = "policy", value = "科技文档实体", dataType = "Policy", required = true)
@Log(title = "科技文档", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody Policy policy)
{
return toAjax(policyService.insertPolicy(policy));
}
/**
* 修改科技文档
*/
@ApiOperation(value="修改科技文档")
@ApiImplicitParam(name = "policy", value = "科技文档实体", dataType = "Policy", required = true)
@Log(title = "科技文档", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public AjaxResult edit(@RequestBody Policy policy)
{
return toAjax(policyService.updatePolicy(policy));
}
/**
* 删除科技文档
*/
@ApiOperation(value="删除科技文档")
@ApiImplicitParam(name = "ids", value = "科技文档数组", dataType = "String[]", required = true)
@Log(title = "科技文档", businessType = BusinessType.DELETE)
@PostMapping("/remove")
public AjaxResult remove(@RequestParam String[] ids)
{
return toAjax(policyService.deletePolicyByIds(ids));
}
<template>
<div class="app-container">
<!-- <div><img v-bind:src="logo" alt="Vue Logo" class="custom-image"></div>-->
<div class="center-container">
<div class="image-container">
<img v-bind:src="logo" alt="Vue Logo" class="custom-image">
</div>
</div>
<!-- <style>-->
<!-- .center-container {-->
<!-- display: flex;-->
<!-- justify-content: center; /* 水平居中 */-->
<!-- align-items: center; /* 垂直居中 */-->
<!-- height: 100vh; /* 让容器占满整个视口高度 */-->
<!-- }-->
<!-- </style>-->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="政策名称 " prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入政策名称 "
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="政策分类" prop="type">-->
<!-- <el-input-->
<!-- v-model="queryParams.type"-->
<!-- placeholder="请输入政策分类"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="发文字号" prop="document">
<el-input
v-model="queryParams.document"
placeholder="请输入发文字号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="制定机关" prop="organ">
<el-input
v-model="queryParams.organ"
placeholder="请输入制定机关"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="发布日期" prop="pubdata">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.pubdata"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择发布日期">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="全文检索" prop="text">
<el-input
v-model="queryParams.text"
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>
<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"-->
<!-- v-hasPermi="['system:policy: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="['system:policy: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="['system:policy: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="['system:policy:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="policyList" @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="type" />
<el-table-column label="发文字号" align="center" prop="document" />
<el-table-column label="制定机关" align="center" prop="organ" />
<el-table-column label="发布日期" align="center" prop="pubdata" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.pubdata, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="全文检索" align="center" prop="text" />-->
<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)"
v-hasPermi="['system:policy:edit']"
>查看</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['system:policy:remove']"-->
<!-- >删除</el-button>-->
</template>
<template slot-scope="scope">
<router-link :to="{ name: 'PolicyView', params: { id: scope.row.id }}">查看</router-link>
</template>
</el-table-column>
</el-table>
<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>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="政策名称 " prop="name">
<el-input v-model="form.name" placeholder="请输入政策名称 " />
</el-form-item>
<el-form-item label="政策分类" prop="type">
<el-input v-model="form.type" placeholder="请输入政策分类" />
</el-form-item>
<el-form-item label="发文字号" prop="document">
<el-input v-model="form.document" placeholder="请输入发文字号" />
</el-form-item>
<el-form-item label="制定机关" prop="organ">
<el-input v-model="form.organ" placeholder="请输入制定机关" />
</el-form-item>
<el-form-item label="发布日期" prop="pubdata">
<el-date-picker clearable
v-model="form.pubdata"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择发布日期">
</el-date-picker>
</el-form-item>
<el-form-item label="全文检索">
<editor v-model="form.text" :min-height="192"/>
</el-form-item>
</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>
</div>
</template>
<script>
import logo from '@/assets/logo/logo.png'
import { listPolicy, getPolicy, delPolicy, addPolicy, updatePolicy } from "@/api/system/policy";
export default {
name: "Policy",
data() {
return {
logo,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 科技文档表格数据
policyList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
document: null,
organ: null,
pubdata: null,
text: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询科技文档列表 */
getList() {
this.loading = true;
listPolicy(this.queryParams).then(response => {
this.policyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
type: null,
document: null,
organ: null,
pubdata: null,
text: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加科技文档";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getPolicy(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改科技文档";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updatePolicy(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPolicy(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除科技文档编号为"' + ids + '"的数据项?').then(function() {
return delPolicy(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('/system-manage-service/system/policy/export', {
...this.queryParams
}, `policy_${new Date().getTime()}.xlsx`)
}
}
};
</script>
标签:科技,--,value,查询,极限,文档,policy,import,五一 From: https://www.cnblogs.com/po3a/p/18252216