非常简单实用的前后端分离项目-仓库管理系统(Springboot+Vue)part 4

三十三、出入库管理

 Header.vue导一下,RecordController加一个

 //将入库数据和原有数据相加吧//新增@PostMapping("/save")public Result save(@RequestBody Record record) {return recordService.save(record) ? Result.success() : Result.fail();}

GoodsManage.vue

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入物品名:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-select v-model="goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><el-button type="primary" style="margin-left:5px" @click="add">新增</el-button><el-button type="success" style="margin-left:5px;" @click="inGoods">重置</el-button></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"borderhighlight-current-row@current-change="selectCurrentChange"><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="name" label="物品名" width="80"></el-table-column><el-table-column prop="storage" label="仓库" :formatter="formatStorage"></el-table-column><el-table-column prop="goodstype" label="分类" :formatter="formatGoodsType"></el-table-column><el-table-column prop="count" label="数量"></el-table-column><el-table-column prop="remark" label="备注"></el-table-column><el-table-column prop="operate" label="操作"><template slot-scope="scope"><el-button size="small" type="success" @click="mod(scope.row)">编辑</el-button><el-popconfirmtitle="确定删除吗?"@confirm="del(scope.row.id)"style="margin-left:8px;"><el-button slot="reference" size="small" type="danger">删除</el-button></el-popconfirm></template></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="物品名" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="仓库" prop="storage"><el-col :span="20"><el-select v-model="form.storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="分类" prop="goodstype"><el-col :span="20"><el-select v-model="form.goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog><el-dialogtitle="提示":visible.sync="inDialogVisible"width="30%"center><el-form ref="form1" :rules="rules1" :model="form1" label-width="80px"><el-form-item label="物品名"><el-col :span="20"><el-input v-model="form1.goodsname" readonly></el-input></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form1.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form1.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="inDialogVisible=false">取消</el-button><el-button type="primary" @click="doInGoods">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>
export default {name: "GoodsManage",data() {let checkCount = (rule, value, callback) => {if (value > 9999) {callback(new Error('数量输入过大'));} else {callback();}};return {user: JSON.parse(sessionStorage.getItem('CurUser')),storageData: [],tableData: [],goodstypeData: [],pageSize: 10,pageNum: 1,storage: '',goodstype: '',total: 0,name: '',centerDialogVisible: false,inDialogVisible: false,currentRow: {},form: {id: '',name: '',remark: '',count: '',storage: '',goodstype: '',},form1: {goods: '',goodsname: '',userid: '13',adminId: '',remark: ''},rules1: {},rules: {name: [{required: true, message: '请输入物品名', trigger: 'blur'},],storage: [{required: true, message: '请选择仓库', trigger: 'blur'}],goodstype: [{required: true, message: '请选择分类’,trigger:‘blur'}],count: [{required: true, message: '请输入数量', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,4}$/, message: '数量必须为正整数', trigger: "blur"},{validator: checkCount, trigger: 'blur'}]}}},methods: {selectCurrentChange(val) {this.currentRow = val;},formatStorage(row) {let temp = this.storageData.find(item => {return item.id === row.storage})return temp && temp.name},formatGoodsType(row) {let temp = this.goodstypeData.find(item => {return item.id === row.goodstype})return temp && temp.name},add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()this.form.id = ''})},inGoods() {if (!this.currentRow.id) {alert('请选择记录');return;}this.inDialogVisible = truethis.$nextTick(() => {this.resetInForm()})this.form1.goodsname = this.currentRow.namethis.form1.goods = this.currentRow.idthis.form1.adminId = this.user.id},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.remark = row.remark;this.form.name = row.name;this.form.storage = row.storage;this.form.goodstype = row.goodstype;this.form.count = row.count;})},del(id) {this.$axios.get(this.$httpUrl + '/goods/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},resetForm() {//this.centerDialogVisible = truethis.$refs.form.resetFields();//this.form.id = '';},resetInForm() {this.$refs.form1.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/goods/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/goods/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadPost() {this.$axios.post(this.$httpUrl + '/goods/listPage', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,goodstype: this.goodstype + '',//string和int强转一下storage: this.storage + ''}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},loadStorage() {this.$axios.get(this.$httpUrl + '/storage/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.storageData = res.data} else {alert('获取数据失败!请刷新页面')}})},loadGoodsType() {this.$axios.get(this.$httpUrl + '/goodstype/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.goodstypeData = res.data} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.storage = ''this.goodstype = ''},doInGoods() {this.$axios.post(this.$httpUrl + '/record/save', this.form1).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.inDialogVisible = falsethis.loadPost();this.resetInForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {this.loadStorage()this.loadGoodsType()this.loadPost()}
}</script>

1. 表里没有操作时间的,按我说的来做,数据库里面类型修改为timestamp,默认那里再加上CURRENT_TIMESTAMP这个默认值,

2.没有时间的直接改成`createtime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间' ON UPDATE CURRENT_TIMESTAMP

3.操作时间为空的搜一下mybaitsplus的注解@TableField,加在实体类里

方法选一个即可 

CREATE TABLE `record` (`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',`goods` int(11) NOT NULL COMMENT '货品id',`userId` int(11) DEFAULT NULL COMMENT '取货人/补货人',`admin_id` int(11) DEFAULT NULL COMMENT '操作人id',`count` int(11) DEFAULT NULL COMMENT '数量',`createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '操作时间',`remark` varchar(1000) DEFAULT NULL COMMENT '备注',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

进一步补充goods的相关方法

package com.wms.controller;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wms.common.QueryPageParam;
import com.wms.common.Result;
import com.wms.entity.Goods;
import com.wms.entity.Record;
import com.wms.service.GoodsService;
import com.wms.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.HashMap;/*** <p>* 前端控制器* </p>** @author wms* @since 2024-12-07*/
@RestController
@RequestMapping("/record")
public class RecordController {@Autowiredprivate RecordService recordService;@Autowiredprivate GoodsService goodsService;@PostMapping("/listPage")public Result listPage(@RequestBody QueryPageParam query) {HashMap param = query.getParam();String name = (String) param.get("name");String storage = (String) param.get("storage");String goodstype = (String) param.get("goodstype");Page<Record> page = new Page();page.setCurrent(query.getPageNum());page.setSize(query.getPageSize());QueryWrapper<Record> queryWrapper = new QueryWrapper();queryWrapper.apply(" a.goods=b.id and b.storage=c.id and b.goodsType=d.id ");if (StringUtils.isNotBlank(name) && !"null".equals(name)) {//lambdaQueryWrapper.like(Record::getName, name);queryWrapper.like("b.name", name);}if (StringUtils.isNotBlank(storage) && !"null".equals(storage)) {queryWrapper.eq("c.id", storage);}if (StringUtils.isNotBlank(goodstype) && !"null".equals(goodstype)) {queryWrapper.eq("d.id", goodstype);}IPage result = recordService.pageCC(page, queryWrapper);return Result.success(result.getRecords(), result.getTotal());}//将入库数据和原有数据相加吧//新增@PostMapping("/save")public Result save(@RequestBody Record record) {Goods goods = goodsService.getById(record.getGoods());int n = record.getCount();int num = goods.getCount() + n;goods.setCount(num);goodsService.updateById(goods);return recordService.save(record) ? Result.success() : Result.fail();}
}

 可以实现初步功能

Record加一句

@TableField(exist=false)
private String action;

 RecordController添加出库相关的内容

 //将入库数据和原有数据相加吧//新增@PostMapping("/save")public Result save(@RequestBody Record record) {Goods goods = goodsService.getById(record.getGoods());int n = record.getCount();//出库if("2".equals(record.getAction())) {n = -n;record.setCount(n);}int num = goods.getCount() + n;goods.setCount(num);goodsService.updateById(goods);return recordService.save(record) ? Result.success() : Result.fail();}

 SelectUser.vue

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入名字:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="sex" filterableplacehoLder="请选择性别" style="margin-left:5px"><el-optionv-for="item in sexs":key="item.value":label="item.label":value="item.value"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><!--<el-button type="primary" style="margin-left:5px" @click="add">新增</el-button>--></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"borderhighlight-current-row@current-change="selectCurrentChange"><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="no" label="账号" width="150"></el-table-column><el-table-column prop="name" label="姓名" width="120"></el-table-column><el-table-column prop="age" label="年龄" width="80"></el-table-column><el-table-column prop="sex" label="性别" width="80"><template slot-scope="scope"><el-tag:type="scope.row.sex === 1 ?'primary':'success'"disable-transitions>{{ scope.row.sex === 1 ? '男' : '女' }}</el-tag></template></el-table-column><el-table-column prop="roleId" label="角色" width="120"><template slot-scope="scope"><el-tag:type="scope.row.roleId === 0 ?'danger':(scope.row.roleId === 1 ?'primary':'success')"disable-transitions>{{ scope.row.roleId === 0 ? '超级管理员' : (scope.row.roleId === 1 ? '管理员' : '用户') }}</el-tag></template></el-table-column><el-table-column prop="phone" label="电话" ></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="账号" prop="no"><el-col :span="20"><el-input v-model="form.no"></el-input></el-col></el-form-item><el-form-item label="密码" prop="password"><el-col :span="20"><el-input v-model="form.password"></el-input></el-col></el-form-item><el-form-item label="名字" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="年龄" prop="age"><el-col :span="20"><el-input v-model="form.age"></el-input></el-col></el-form-item><el-form-item label="性别"><el-radio-group v-model="form.sex"><el-radio label="1">男</el-radio><el-radio label="0">女</el-radio></el-radio-group></el-form-item><el-form-item label="电话" prop="phone"><el-col :span="20"><el-input v-model="form.phone"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>
export default {name: "SelectUser",data() {let checkAge = (rule, value, callback) => {if (value > 150) {callback(new Error('年龄太大!lbd再来我让你飞起来!'));} else {callback();}};let checkDuplicate = (rule, value, callback) => {if (this.form.id) {return callback();}this.$axios.get(this.$httpUrl + "/user/findByNo?no=" + this.form.no).then(res => res.data).then(res => {if (res.code !== 200) {//es6解构也可以callback();} else {callback(new Error('账号已经存在'));}});};return {tableData: [],pageSize: 10,pageNum: 1,total: 0,name: '',sex: '',sexs: [{value: '1',label: '男'}, {value: '0',label: '女'}],centerDialogVisible: false,form: {name: '',no: '',age: '',password: '',phone: '',sex: '0',roleId: '2'},rules: {no: [{required: true, message: '请输入账号', trigger: 'blur'},{min: 3, max: 8, message: '长度在3-8个字符', trigger: 'blur'},{validator: checkDuplicate, trigger: 'blur'}],name: [{required: true, message: '请输入名字', trigger: 'blur'},],password: [{required: true, message: '请输入密码', trigger: 'blur'},{min: 4, max: 10, message: '长度在4-10个字符之间', trigger: 'blur'}],age: [{required: true, message: '请输入年龄', trigger: 'blur'},{min: 1, max: 3, message: '长度在1到3个位', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,3}$/, message: '年龄必须为正整数字', trigger: "blur"},{validator: checkAge, trigger: 'blur'}],phone: [{required: true, message: "手机号不能为空", trigger: "blur"},{pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur"}]}}},methods: {add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()})},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.no = row.no;this.form.name = row.name;this.form.sex = row.sex + '';this.form.age = row.age + '';//转化成字符串类型this.form.phone = row.phone;this.form.password = '';this.form.roleId = row.roleId;})//修改User的时候要确保账号不能修改,否则有可能会数据库存在账号相同的情况!!!!给账号的input里加个v-bind:disabled="isDisabled“,如果是修改就把isDisabled设置为true,添加就false},del(id) {this.$axios.get(this.$httpUrl + '/user/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},resetForm() {this.centerDialogVisible = truethis.$refs.form.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/user/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/user/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadGet() {this.$axios.get(this.$httpUrl + '/user/list').then(res => res.data).then(res => {console.log(res)})},loadPost() {this.$axios.post(this.$httpUrl + '/user/listPageC1', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,sex: this.sex,roleId:'2'}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.sex = ''},selectCurrentChange(val) {//this.currentRow=valthis.$emit("doSelectUser",val)},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {// this.loadGet();this.loadPost()}
}</script>

GoodsManage.vue

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入物品名:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-select v-model="goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><el-button type="primary" style="margin-left:5px" @click="add">新增</el-button><el-button type="success" style="margin-left:5px;" @click="inGoods">入库</el-button><el-button type="success" style="margin-left:5px;" @click="outGoods">出库</el-button></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"borderhighlight-current-row@current-change="selectCurrentChange"><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="name" label="物品名" width="80"></el-table-column><el-table-column prop="storage" label="仓库" :formatter="formatStorage"></el-table-column><el-table-column prop="goodstype" label="分类" :formatter="formatGoodsType"></el-table-column><el-table-column prop="count" label="数量"></el-table-column><el-table-column prop="remark" label="备注"></el-table-column><el-table-column prop="operate" label="操作"><template slot-scope="scope"><el-button size="small" type="success" @click="mod(scope.row)">编辑</el-button><el-popconfirmtitle="确定删除吗?"@confirm="del(scope.row.id)"style="margin-left:8px;"><el-button slot="reference" size="small" type="danger">删除</el-button></el-popconfirm></template></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="物品维护":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="物品名" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="仓库" prop="storage"><el-col :span="20"><el-select v-model="form.storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="分类" prop="goodstype"><el-col :span="20"><el-select v-model="form.goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog><el-dialogtitle="出入库":visible.sync="inDialogVisible"width="30%"center><el-dialogwidth="70%"title="用户选择":visible.sync="innerVisible"append-to-body><SelectUser @doSelectUser="doSelectUser"></SelectUser><span slot="footer" class="dialog-footer"><el-button @click="innerVisible=false">取消</el-button><el-button type="primary" @click="confirmUser">确定</el-button></span></el-dialog><el-form ref="form1" :rules="rules1" :model="form1" label-width="80px"><el-form-item label="物品名"><el-col :span="20"><el-input v-model="form1.goodsname" readonly></el-input></el-col></el-form-item><el-form-item label="申请人"><el-col :span="20"><el-input v-model="form1.username" readonly @click.native="selectUser"></el-input></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form1.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form1.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="inDialogVisible=false">取消</el-button><el-button type="primary" @click="doInGoods">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>import SelectUser from "../user/SelectUser";export default {name: "GoodsManage",components: {SelectUser},data() {let checkCount = (rule, value, callback) => {if (value > 9999) {callback(new Error('数量输入过大'));} else {callback();}};return {user: JSON.parse(sessionStorage.getItem('CurUser')),storageData: [],tableData: [],goodstypeData: [],pageSize: 10,pageNum: 1,storage: '',goodstype: '',total: 0,name: '',centerDialogVisible: false,inDialogVisible: false,innerVisible: false,currentRow: {},tempUser: {},form: {id: '',name: '',remark: '',count: '',storage: '',goodstype: '',},form1: {goods: '',goodsname: '',count: '',username: '',userid: '',adminId: '',remark: '',action:1,},rules1: {},rules: {name: [{required: true, message: '请输入物品名', trigger: 'blur'},],storage: [{required: true, message: '请选择仓库', trigger: 'blur'}],goodstype: [{required: true, message: '请选择分类’,trigger:‘blur'}],count: [{required: true, message: '请输入数量', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,4}$/, message: '数量必须为正整数', trigger: "blur"},{validator: checkCount, trigger: 'blur'}]}}},methods: {confirmUser() {this.username = this.tempUser.namethis.userid = this.tempUser.idthis.innerVisible = false},doSelectUser(val) {console.log(val)this.tempUser = val},selectCurrentChange(val) {this.currentRow = val;},formatStorage(row) {let temp = this.storageData.find(item => {return item.id === row.storage})return temp && temp.name},formatGoodsType(row) {let temp = this.goodstypeData.find(item => {return item.id === row.goodstype})return temp && temp.name},add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()this.form.id = ''})},inGoods() {if (!this.currentRow.id) {alert('请选择记录');return;}this.inDialogVisible = truethis.$nextTick(() => {this.resetInForm()})this.form1.goodsname = this.currentRow.namethis.form1.goods = this.currentRow.idthis.form1.adminId = this.user.idthis.form1.action = '1'},outGoods() {if (!this.currentRow.id) {alert('请选择记录');return;}this.inDialogVisible = truethis.$nextTick(() => {this.resetInForm()})this.form1.goodsname = this.currentRow.namethis.form1.goods = this.currentRow.idthis.form1.adminId = this.user.idthis.form1.action = '2'},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.remark = row.remark;this.form.name = row.name;this.form.storage = row.storage;this.form.goodstype = row.goodstype;this.form.count = row.count;})},del(id) {this.$axios.get(this.$httpUrl + '/goods/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},selectUser() {this.innerVisible = true;},resetForm() {//this.centerDialogVisible = truethis.$refs.form.resetFields();//this.form.id = '';},resetInForm() {this.$refs.form1.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/goods/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/goods/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadPost() {this.$axios.post(this.$httpUrl + '/goods/listPage', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,goodstype: this.goodstype + '',//string和int强转一下storage: this.storage + ''}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},loadStorage() {this.$axios.get(this.$httpUrl + '/storage/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.storageData = res.data} else {alert('获取数据失败!请刷新页面')}})},loadGoodsType() {this.$axios.get(this.$httpUrl + '/goodstype/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.goodstypeData = res.data} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.storage = ''this.goodstype = ''},doInGoods() {this.$axios.post(this.$httpUrl + '/record/save', this.form1).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.inDialogVisible = falsethis.loadPost();this.resetInForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {this.loadStorage()this.loadGoodsType()this.loadPost()}
}</script>

申请人不知道为什么没传上去 😡😡😡😡😡😡😡😡😡😡😡😡

三十四、权限控制优化

如果要保险得在后端用过滤器进行监听,但是我懒得做

SelectUser

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入名字:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="sex" filterableplacehoLder="请选择性别" style="margin-left:5px"><el-optionv-for="item in sexs":key="item.value":label="item.label":value="item.value"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><!--<el-button type="primary" style="margin-left:5px" @click="add">新增</el-button>--></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"borderhighlight-current-row@current-change="selectCurrentChange"><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="no" label="账号" width="150"></el-table-column><el-table-column prop="name" label="姓名" width="120"></el-table-column><el-table-column prop="age" label="年龄" width="80"></el-table-column><el-table-column prop="sex" label="性别" width="80"><template slot-scope="scope"><el-tag:type="scope.row.sex === 1 ?'primary':'success'"disable-transitions>{{ scope.row.sex === 1 ? '男' : '女' }}</el-tag></template></el-table-column><el-table-column prop="roleId" label="角色" width="120"><template slot-scope="scope"><el-tag:type="scope.row.roleId === 0 ?'danger':(scope.row.roleId === 1 ?'primary':'success')"disable-transitions>{{ scope.row.roleId === 0 ? '超级管理员' : (scope.row.roleId === 1 ? '管理员' : '用户') }}</el-tag></template></el-table-column><el-table-column prop="phone" label="电话" ></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="账号" prop="no"><el-col :span="20"><el-input v-model="form.no"></el-input></el-col></el-form-item><el-form-item label="密码" prop="password"><el-col :span="20"><el-input v-model="form.password"></el-input></el-col></el-form-item><el-form-item label="名字" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="年龄" prop="age"><el-col :span="20"><el-input v-model="form.age"></el-input></el-col></el-form-item><el-form-item label="性别"><el-radio-group v-model="form.sex"><el-radio label="1">男</el-radio><el-radio label="0">女</el-radio></el-radio-group></el-form-item><el-form-item label="电话" prop="phone"><el-col :span="20"><el-input v-model="form.phone"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>
export default {name: "SelectUser",data() {let checkAge = (rule, value, callback) => {if (value > 150) {callback(new Error('年龄太大!lbd再来我让你飞起来!'));} else {callback();}};let checkDuplicate = (rule, value, callback) => {if (this.form.id) {return callback();}this.$axios.get(this.$httpUrl + "/user/findByNo?no=" + this.form.no).then(res => res.data).then(res => {if (res.code !== 200) {//es6解构也可以callback();} else {callback(new Error('账号已经存在'));}});};return {tableData: [],pageSize: 10,pageNum: 1,total: 0,name: '',sex: '',sexs: [{value: '1',label: '男'}, {value: '0',label: '女'}],centerDialogVisible: false,form: {name: '',no: '',age: '',password: '',phone: '',sex: '0',roleId: '2'},rules: {no: [{required: true, message: '请输入账号', trigger: 'blur'},{min: 3, max: 8, message: '长度在3-8个字符', trigger: 'blur'},{validator: checkDuplicate, trigger: 'blur'}],name: [{required: true, message: '请输入名字', trigger: 'blur'},],password: [{required: true, message: '请输入密码', trigger: 'blur'},{min: 4, max: 10, message: '长度在4-10个字符之间', trigger: 'blur'}],age: [{required: true, message: '请输入年龄', trigger: 'blur'},{min: 1, max: 3, message: '长度在1到3个位', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,3}$/, message: '年龄必须为正整数字', trigger: "blur"},{validator: checkAge, trigger: 'blur'}],phone: [{required: true, message: "手机号不能为空", trigger: "blur"},{pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur"}]}}},methods: {add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()})},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.no = row.no;this.form.name = row.name;this.form.sex = row.sex + '';this.form.age = row.age + '';//转化成字符串类型this.form.phone = row.phone;this.form.password = '';this.form.roleId = row.roleId;})//修改User的时候要确保账号不能修改,否则有可能会数据库存在账号相同的情况!!!!给账号的input里加个v-bind:disabled="isDisabled“,如果是修改就把isDisabled设置为true,添加就false},del(id) {this.$axios.get(this.$httpUrl + '/user/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},resetForm() {this.centerDialogVisible = truethis.$refs.form.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/user/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/user/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadGet() {this.$axios.get(this.$httpUrl + '/user/list').then(res => res.data).then(res => {console.log(res)})},loadPost() {this.$axios.post(this.$httpUrl + '/user/listPageC1', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,sex: this.sex,roleId:'2'}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.sex = ''},selectCurrentChange(val) {//this.currentRow=valthis.$emit("doSelectUser",val)},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {// this.loadGet();this.loadPost()}
}</script>

GoodsManage

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入物品名:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-select v-model="goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><el-button type="primary" style="margin-left:5px" @click="add" v-if="user.roleId!=2">新增</el-button><el-button type="success" style="margin-left:5px;" @click="inGoods" v-if="user.roleId!=2">入库</el-button><el-button type="success" style="margin-left:5px;" @click="outGoods" v-if="user.roleId!=2">出库</el-button></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"borderhighlight-current-row@current-change="selectCurrentChange"><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="name" label="物品名" width="80"></el-table-column><el-table-column prop="storage" label="仓库" :formatter="formatStorage"></el-table-column><el-table-column prop="goodstype" label="分类" :formatter="formatGoodsType"></el-table-column><el-table-column prop="count" label="数量"></el-table-column><el-table-column prop="remark" label="备注"></el-table-column><el-table-column prop="operate" label="操作" v-if="user.roleId!=2"><template slot-scope="scope"><el-button size="small" type="success" @click="mod(scope.row)">编辑</el-button><el-popconfirmtitle="确定删除吗?"@confirm="del(scope.row.id)"style="margin-left:8px;"><el-button slot="reference" size="small" type="danger">删除</el-button></el-popconfirm></template></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="物品维护":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="物品名" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="仓库" prop="storage"><el-col :span="20"><el-select v-model="form.storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="分类" prop="goodstype"><el-col :span="20"><el-select v-model="form.goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog><el-dialogtitle="出入库":visible.sync="inDialogVisible"width="30%"center><el-dialogwidth="70%"title="用户选择":visible.sync="innerVisible"append-to-body><SelectUser @doSelectUser="doSelectUser"></SelectUser><span slot="footer" class="dialog-footer"><el-button @click="innerVisible=false">取消</el-button><el-button type="primary" @click="confirmUser">确定</el-button></span></el-dialog><el-form ref="form1" :rules="rules1" :model="form1" label-width="80px"><el-form-item label="物品名"><el-col :span="20"><el-input v-model="form1.goodsname" readonly></el-input></el-col></el-form-item><el-form-item label="申请人"><el-col :span="20"><el-input v-model="form1.username" readonly @click.native="selectUser"></el-input></el-col></el-form-item><el-form-item label="数量" prop="count"><el-col :span="20"><el-input v-model="form1.count"></el-input></el-col></el-form-item><el-form-item label="备注" prop="remark"><el-col :span="20"><el-input type="textarea" v-model="form1.remark"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="inDialogVisible=false">取消</el-button><el-button type="primary" @click="doInGoods">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>import SelectUser from "../user/SelectUser";export default {name: "GoodsManage",components: {SelectUser},data() {let checkCount = (rule, value, callback) => {if (value > 9999) {callback(new Error('数量输入过大'));} else {callback();}};return {user: JSON.parse(sessionStorage.getItem('CurUser')),storageData: [],tableData: [],goodstypeData: [],pageSize: 10,pageNum: 1,storage: '',goodstype: '',total: 0,name: '',centerDialogVisible: false,inDialogVisible: false,innerVisible: false,currentRow: {},tempUser: {},form: {id: '',name: '',remark: '',count: '',storage: '',goodstype: '',},form1: {goods: '',goodsname: '',count: '',username: '',userid: '',adminId: '',remark: '',action: 1,},rules1: {},rules: {name: [{required: true, message: '请输入物品名', trigger: 'blur'},],storage: [{required: true, message: '请选择仓库', trigger: 'blur'}],goodstype: [{required: true, message: '请选择分类’,trigger:‘blur'}],count: [{required: true, message: '请输入数量', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,4}$/, message: '数量必须为正整数', trigger: "blur"},{validator: checkCount, trigger: 'blur'}]}}},methods: {confirmUser() {this.username = this.tempUser.namethis.userid = this.tempUser.idthis.innerVisible = false},doSelectUser(val) {console.log(val)this.tempUser = val},selectCurrentChange(val) {this.currentRow = val;},formatStorage(row) {let temp = this.storageData.find(item => {return item.id === row.storage})return temp && temp.name},formatGoodsType(row) {let temp = this.goodstypeData.find(item => {return item.id === row.goodstype})return temp && temp.name},add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()this.form.id = ''})},inGoods() {if (!this.currentRow.id) {alert('请选择记录');return;}this.inDialogVisible = truethis.$nextTick(() => {this.resetInForm()})this.form1.goodsname = this.currentRow.namethis.form1.goods = this.currentRow.idthis.form1.adminId = this.user.idthis.form1.action = '1'},outGoods() {if (!this.currentRow.id) {alert('请选择记录');return;}this.inDialogVisible = truethis.$nextTick(() => {this.resetInForm()})this.form1.goodsname = this.currentRow.namethis.form1.goods = this.currentRow.idthis.form1.adminId = this.user.idthis.form1.action = '2'},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.remark = row.remark;this.form.name = row.name;this.form.storage = row.storage;this.form.goodstype = row.goodstype;this.form.count = row.count;})},del(id) {this.$axios.get(this.$httpUrl + '/goods/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},selectUser() {this.innerVisible = true;},resetForm() {//this.centerDialogVisible = truethis.$refs.form.resetFields();//this.form.id = '';},resetInForm() {this.$refs.form1.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/goods/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/goods/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadPost() {this.$axios.post(this.$httpUrl + '/goods/listPage', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,goodstype: this.goodstype + '',//string和int强转一下storage: this.storage + ''}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},loadStorage() {this.$axios.get(this.$httpUrl + '/storage/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.storageData = res.data} else {alert('获取数据失败!请刷新页面')}})},loadGoodsType() {this.$axios.get(this.$httpUrl + '/goodstype/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.goodstypeData = res.data} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.storage = ''this.goodstype = ''},doInGoods() {this.$axios.post(this.$httpUrl + '/record/save', this.form1).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.inDialogVisible = falsethis.loadPost();this.resetInForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {this.loadStorage()this.loadGoodsType()this.loadPost()}
}</script>

RecordManage

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入物品名:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="storage" placehoLder="请选择仓库" style="margin-left: 5px;"><el-optionv-for="item in storageData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-select v-model="goodstype" placeholder="请选择分类" style="margin-left: 5px;"><el-optionv-for="item in goodstypeData":key="item.id":label="item.name":value="item.id"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"border><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="goodsname" label="物品名" width="80"></el-table-column><el-table-column prop="storagename" label="仓库"  ></el-table-column><el-table-column prop="goodstypename" label="分类"  ></el-table-column><el-table-column prop="adminname" label="操作人"  ></el-table-column><el-table-column prop="username" label="申请人"  ></el-table-column><el-table-column prop="count" label="数量"></el-table-column><el-table-column prop="createtime" label="操作时间"></el-table-column><el-table-column prop="remark" label="备注"></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination></div>
</template><style scoped></style>
<script>
export default {name: "RecordManage",data() {return {user:JSON.parse(sessionStorage.getItem('CurUser')),storageData: [],tableData: [],goodstypeData: [],pageSize: 10,pageNum: 1,storage: '',goodstype: '',total: 0,name: '',centerDialogVisible: false,form: {id: '',name: '',remark: '',count: '',storage: '',goodstype: '',},}},methods: {formatStorage(row) {let temp = this.storageData.find(item => {return item.id === row.storage})return temp && temp.name},formatGoodsType(row) {let temp = this.goodstypeData.find(item => {return item.id === row.goodstype})return temp && temp.name},add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()this.form.id = ''})},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.remark = row.remark;this.form.name = row.name;this.form.storage = row.storage;this.form.goodstype = row.goodstype;this.form.count = row.count;})},del(id) {this.$axios.get(this.$httpUrl + '/goods/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},resetForm() {this.centerDialogVisible = truethis.$refs.form.resetFields();this.form.id = '';},doSave() {this.$axios.post(this.$httpUrl + '/goods/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/goods/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadPost() {this.$axios.post(this.$httpUrl + '/record/listPage', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,goodstype: this.goodstype + '',//string和int强转一下storage: this.storage + '',roleId:this.user.roleId+'',userId:this.user.id+'',}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},loadStorage() {this.$axios.get(this.$httpUrl + '/storage/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.storageData = res.data} else {alert('获取数据失败!请刷新页面')}})},loadGoodsType() {this.$axios.get(this.$httpUrl + '/goodstype/list').then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.goodstypeData = res.data} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.storage = ''this.goodstype = ''},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {this.loadGoodsType()this.loadStorage()this.loadPost()}
}</script>

RecordController

package com.wms.controller;import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wms.common.QueryPageParam;
import com.wms.common.Result;
import com.wms.entity.Goods;
import com.wms.entity.Record;
import com.wms.service.GoodsService;
import com.wms.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.HashMap;/*** <p>* 前端控制器* </p>** @author wms* @since 2024-12-07*/
@RestController
@RequestMapping("/record")
public class RecordController {@Autowiredprivate RecordService recordService;@Autowiredprivate GoodsService goodsService;@PostMapping("/listPage")public Result listPage(@RequestBody QueryPageParam query) {HashMap param = query.getParam();String name = (String) param.get("name");String storage = (String) param.get("storage");String goodstype = (String) param.get("goodstype");String roleId = (String) param.get("roleId");String userId = (String) param.get("userId");Page<Record> page = new Page();page.setCurrent(query.getPageNum());page.setSize(query.getPageSize());QueryWrapper<Record> queryWrapper = new QueryWrapper();queryWrapper.apply(" a.goods=b.id and b.storage=c.id and b.goodsType=d.id ");if("2".equals(roleId)) {//queryWrapper.eq(Record::getUserid, userId);queryWrapper.apply("a.userId="+userId);}if (StringUtils.isNotBlank(name) && !"null".equals(name)) {//lambdaQueryWrapper.like(Record::getName, name);queryWrapper.like("b.name", name);}if (StringUtils.isNotBlank(storage) && !"null".equals(storage)) {queryWrapper.eq("c.id", storage);}if (StringUtils.isNotBlank(goodstype) && !"null".equals(goodstype)) {queryWrapper.eq("d.id", goodstype);}IPage result = recordService.pageCC(page, queryWrapper);return Result.success(result.getRecords(), result.getTotal());}//将入库数据和原有数据相加吧//新增@PostMapping("/save")public Result save(@RequestBody Record record) {Goods goods = goodsService.getById(record.getGoods());int n = record.getCount();//出库if("2".equals(record.getAction())) {n = -n;record.setCount(n);}int num = goods.getCount() + n;goods.setCount(num);goodsService.updateById(goods);return recordService.save(record) ? Result.success() : Result.fail();}
}

UserManage

<template><div><div style="margin-left:5px"><el-input v-model="name" placeholder="请输入名字:" suffix-icon="el-icon-search" style="width:200px;"@keyup.enter.native="loadPost"></el-input><el-select v-model="sex" filterableplacehoLder="请选择性别" style="margin-left:5px"><el-optionv-for="item in sexs":key="item.value":label="item.label":value="item.value"></el-option></el-select><el-button type="primary" style="margin-left:5px" @click="loadPost">查询</el-button><el-button type="success" @click="resetParam">重置</el-button><el-button type="primary" style="margin-left:5px" @click="add">新增</el-button></div><el-table :data="tableData":header-cell-style="{background:'#f2f5fc',color:'#555'}"border><el-table-column prop="id" label="ID" width="60"></el-table-column><el-table-column prop="no" label="账号" width="120"></el-table-column><el-table-column prop="name" label="姓名" width="80"></el-table-column><el-table-column prop="age" label="年龄" width="80"></el-table-column><el-table-column prop="sex" label="性别" width="80"><template slot-scope="scope"><el-tag:type="scope.row.sex === 1 ?'primary':'success'"disable-transitions>{{ scope.row.sex === 1 ? '男' : '女' }}</el-tag></template></el-table-column><el-table-column prop="roleId" label="角色" width="120"><template slot-scope="scope"><el-tag:type="scope.row.roleId === 0 ?'danger':(scope.row.roleId === 1 ?'primary':'success')"disable-transitions>{{ scope.row.roleId === 0 ? '超级管理员' : (scope.row.roleId === 1 ? '管理员' : '用户') }}</el-tag></template></el-table-column><el-table-column prop="phone" label="电话" width="120"></el-table-column><el-table-column prop="operate" label="操作"><template slot-scope="scope"><el-button size="small" type="success" @click="mod(scope.row)">编辑</el-button><el-popconfirmtitle="确定删除吗?"@confirm="del(scope.row.id)"style="margin-left:8px;"><el-button  slot="reference" size="small" type="danger">删除</el-button></el-popconfirm></template></el-table-column></el-table><el-pagination@size-change="handleSizeChange"@current-change="handleCurrentChange":current-page="pageNum":page-sizes="[5, 10, 20, 50]":page-size="pageSize"layout="total, sizes, prev, pager, next, jumper":total="total"></el-pagination><el-dialogtitle="提示":visible.sync="centerDialogVisible"width="30%"center><el-form ref="form" :rules="rules" :model="form" label-width="80px"><el-form-item label="账号" prop="no"><el-col :span="20"><el-input v-model="form.no"></el-input></el-col></el-form-item><el-form-item label="密码" prop="password"><el-col :span="20"><el-input v-model="form.password"></el-input></el-col></el-form-item><el-form-item label="名字" prop="name"><el-col :span="20"><el-input v-model="form.name"></el-input></el-col></el-form-item><el-form-item label="年龄" prop="age"><el-col :span="20"><el-input v-model="form.age"></el-input></el-col></el-form-item><el-form-item label="性别"><el-radio-group v-model="form.sex"><el-radio label="1">男</el-radio><el-radio label="0">女</el-radio></el-radio-group></el-form-item><el-form-item label="电话" prop="phone"><el-col :span="20"><el-input v-model="form.phone"></el-input></el-col></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="centerDialogVisible=false">取消</el-button><el-button type="primary" @click="save">确定</el-button></span></el-dialog></div>
</template><style scoped></style>
<script>
export default {name: "UserManage",data() {let checkAge = (rule, value, callback) => {if (value > 150) {callback(new Error('年龄太大!lbd再来我让你飞起来!'));} else {callback();}};let checkDuplicate = (rule, value, callback) => {if (this.form.id) {return callback();}this.$axios.get(this.$httpUrl + "/user/findByNo?no=" + this.form.no).then(res => res.data).then(res => {if (res.code !== 200) {//es6解构也可以callback();} else {callback(new Error('账号已经存在'));}});};return {tableData: [],pageSize: 10,pageNum: 1,total: 0,name: '',sex: '',sexs: [{value: '1',label: '男'}, {value: '0',label: '女'}],centerDialogVisible: false,form: {name: '',no: '',age: '',password: '',phone: '',sex: '0',roleId: '2'},rules: {no: [{required: true, message: '请输入账号', trigger: 'blur'},{min: 3, max: 8, message: '长度在3-8个字符', trigger: 'blur'},{validator: checkDuplicate, trigger: 'blur'}],name: [{required: true, message: '请输入名字', trigger: 'blur'},],password: [{required: true, message: '请输入密码', trigger: 'blur'},{min: 4, max: 10, message: '长度在4-10个字符之间', trigger: 'blur'}],age: [{required: true, message: '请输入年龄', trigger: 'blur'},{min: 1, max: 3, message: '长度在1到3个位', trigger: 'blur'},{pattern: /^([1-9][0-9]*){1,3}$/, message: '年龄必须为正整数字', trigger: "blur"},{validator: checkAge, trigger: 'blur'}],phone: [{required: true, message: "手机号不能为空", trigger: "blur"},{pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur"}]}}},methods: {add() {this.centerDialogVisible = truethis.$nextTick(() => {this.resetForm()})},mod(row) {//this.form=row就可以了this.centerDialogVisible = truethis.$nextTick(() => {this.form.id = row.id;this.form.no = row.no;this.form.name = row.name;this.form.sex = row.sex + '';this.form.age = row.age + '';//转化成字符串类型this.form.phone = row.phone;this.form.password = '';this.form.roleId = row.roleId;})//修改User的时候要确保账号不能修改,否则有可能会数据库存在账号相同的情况!!!!给账号的input里加个v-bind:disabled="isDisabled“,如果是修改就把isDisabled设置为true,添加就false},del(id) {this.$axios.get(this.$httpUrl + '/user/del?id=' + id).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.loadPost();} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},resetForm() {this.centerDialogVisible = truethis.$refs.form.resetFields();},doSave() {this.$axios.post(this.$httpUrl + '/user/save', this.form).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = falsethis.loadPost();this.resetForm()} else {this.$message({message: '操作失败!请返回重新操作...',type: 'error'});}});},doMod() {this.$axios.post(this.$httpUrl + '/user/update', this.form).then(res => res.data).then(res => {console.log(res);if (res.code == 200) {this.$message({message: '操作成功!',type: 'success'});this.centerDialogVisible = false;this.loadPost();this.resetForm();} else {this.$message({message: '操作失败!',type: 'error'});}});},save() {this.$refs.form.validate((valid) => {if (valid) {if (this.form.id) {this.doMod();} else {this.doSave();}} else {console.log('error submit!!');return false;}});},loadGet() {this.$axios.get(this.$httpUrl + '/user/list').then(res => res.data).then(res => {console.log(res)})},loadPost() {this.$axios.post(this.$httpUrl + '/user/listPageC1', {pageSize: this.pageSize,pageNum: this.pageNum,param: {name: this.name,sex: this.sex,roleId:'2'}}).then(res => res.data).then(res => {console.log(res)if (res.code === 200) {this.tableData = res.datathis.total = res.total} else {alert('获取数据失败!请刷新页面')}})},resetParam() {this.name = ''this.sex = ''},handleSizeChange(val) {console.log(`每页 ${val} 条`);this.pageNum = 1//这个错误是先翻到第二页在调页面条数,显示无数据this.pageSize = valthis.loadPost()},handleCurrentChange(val) {console.log(`当前页: ${val}`);this.pageNum = valthis.loadPost()}},beforeMount() {// this.loadGet();this.loadPost()}
}</script>

三十五、如何部署前后端分离项目

预计在linux系统上部署并且部署到网站中去😭😭😭😭😭😭😭我看拖拖大法将会发挥作用

一、 要求:

1.后端:IDEAmaven
2.前端:node、vue环境
3.数据库:mysql

二、步骤:
1.获取代码放置到相应目录
2.后端代码处理

  • jdk版本
  • maven配置(路径配置、是否生效)
  • 执行数据库的脚本和修改数据库连接配置主机ip
  • 启动服务验证

     右键pom文件add maven即可

3.前端代码处理

  • 加载依赖           npm i
  • 配置执行环境
  • 启动验证

三十六、Vuex持久化后浏览器刷新丢失数据

1.分析

vuex持久化后,每当浏览器刷新就会丢失state中的数据
有没有办法可以保存这个state的数据呢?

2.插件vuex-persistedstate使用

安装:npm i vuex-persistedstate
在store/index.js 引入:

import createPersistedState from 'vuex-persistedstate'


使用:

plugins:[createPersistedState()]

3.菜单问题解决

菜单还在但是路由没了

4.动态路由问题

在App.vue中

<template><div id="app"><router-view></router-view></div>
</template><script>export default {name: 'App',components: { },data(){return{user:JSON.parse(sessionStorage.getItem('CurUser')),}},watch:{'$store.state.menu':{handler(val,old){if(!old&&this.user&&this.user.no){this.$store.commit("setRouter",val)}},immediate:true}}
}
</script><style></style>

store/index.js中添加

mutations: {setMenu(state,menuList) {state.menu=menuListaddNewRoute(menuList)},setRouter(state,menuList) {addNewRoute(menuList)}
},

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/486589.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Leetcode—1133. 最大唯一数【简单】Plus

2024每日刷题&#xff08;205&#xff09; Leetcode—1133. 最大唯一数 C 实现代码 class Solution { public:int largestUniqueNumber(vector<int>& nums) {constexpr int MAX 1000;vector<int> count(MAX 1, 0);for(int num: nums) {count[num];}for(int…

如何通过自学成长为一名后端开发工程师?

大家好&#xff0c;我是袁庭新。最近&#xff0c;有星友向我提出了一个很好的问题&#xff1a;如何通过自学成为一名后端开发工程师&#xff1f; 为了解答这个疑问&#xff0c;我特意制作了一个视频来详细分享我的看法和建议。 戳链接&#xff1a;如何通过自学成长为一名后端开…

GCC/G++ Centos离线安装

方式一&#xff08;推荐&#xff09; 官方地址&#xff1a;https://gcc.gnu.org/releases.html 镜像站点1&#xff1a;http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/ 镜像站点2&#xff1a;https://vault.centos.org/7.5.1804/os/x86_64/Packages/ gcc &#xff1a…

工业—使用Flink处理Kafka中的数据_ChangeRecord2

使用 Flink 消费 Kafka 中 ChangeRecord 主题的数据,每隔 1 分钟输出最近 3 分钟的预警次数最多的 设备,将结果存入Redis 中, key 值为

【GoLang】文件操作中perm参数的用法

我们在创建文件时&#xff0c; perm 参数主要用于设置新创建文件的权限&#xff0c;有时是0755&#xff0c;有时是0644。那你知道这些数字都代表什么意思吗&#xff1f; 让我们一个个数字拆开了说&#xff0c;现在从左到右给每个数字一个编号 编号1&#xff1a;通常是0&…

【Selenium】基于 WebDriverWait 爬取带有懒加载的静态页面

0x00 前言 朋友做标书&#xff0c;需要用到每日温度&#xff0c;他的老板让在这个网页手动复制做一个长期表出来&#xff1a;http://www.tianqihoubao.com/lishi/nanjing/month/202412.html 想着帮个忙&#xff0c;做个爬虫脚本吧&#xff0c;忽然发现这个页面很有意思&#xf…

fpga vga

因为 如果是减1的话是会少减1的 因为piel_x会延迟 timescale 1ns / 1psmodule vga(//系统侧input wire clk_sys ,input wire rst_n ,input wire clk ,//在顶层例化的pll产生的input wire locked ,/…

RNACOS:用Rust实现的Nacos服务

RNACOS是一个使用Rust语言开发的Nacos服务实现&#xff0c;它继承了Nacos的所有核心功能&#xff0c;并在此基础上进行了优化和改进。作为一个轻量级、快速、稳定且高性能的服务&#xff0c;RNACOS不仅包含了注册中心、配置中心和Web管理控制台的功能&#xff0c;还支持单机和集…

如何做好一份技术文档?-中小企实战运营和营销工作室博客

做好一份技术文档需要考虑文档的目的、受众、内容结构、表达清晰度等多个方面&#xff0c;以下是详细步骤&#xff1a; 一、明确文档目的和受众 确定目的 技术文档的目的可能多种多样&#xff0c;例如记录软件系统的功能和操作流程&#xff0c;便于用户使用&#xff1b;或是作为…

【Java语言】内部类

可以将一个类的定义在另一个类或者一个方法内部&#xff08;一般都是定义在类里面&#xff09;&#xff0c;在内部的类就称为内部类&#xff0c;在内部类的外部的类称为外部类。内部类可以在数据结构实现链表的结点等还有很多的地方使用它。然而内部类又分四种&#xff1a;静态…

DemoFusion 技术浅析(三):渐进式上采样

渐进式上采样模块&#xff08;Progressive Upsampling Module&#xff09; 是 DemoFusion 框架的核心组件之一&#xff0c;其主要目标是逐步提高图像分辨率&#xff0c;同时保留和增强图像细节。为了实现这一目标&#xff0c;该模块结合了多种上采样技术、扩散模型以及精细化的…

软件工程 测试

软件测试是根据从用户和系统规范收集的需求对软件进行评估。测试在软件开发生命周期的阶段级别或程序代码的模块级别进行。软件测试包括验证和确认。 软件验证 验证是检查软件是否满足用户要求的过程。它在 SDLC 结束时执行。如果软件符合它的要求&#xff0c;他就会被验证。…

在CANoe中Ping多播地址的若干问题

在CANoe中添加网络节点Dut,作为加入多播组的主机,配置TCP/IP Stack和网卡参数: IP地址:192.168.0.17MAC地址:02:00:00:00:00:17在CANoe中添加网络节点Tester,作为发送多播报文的数据源,配置TCP/IP Stack和网卡参数: IP地址:192.168.0.52MAC地址:02:00:00:00:00:52Dut…

基于51单片机64位病床呼叫系统设计( proteus仿真+程序+设计报告+原理图+讲解视频)

基于51单片机病床呼叫系统设计( proteus仿真程序设计报告原理图讲解视频&#xff09; 仿真图proteus7.8及以上 程序编译器&#xff1a;keil 4/keil 5 编程语言&#xff1a;C语言 设计编号&#xff1a;S0095 1. 主要功能&#xff1a; 基于51单片机的病床呼叫系统proteus仿…

【机器学习算法】——逻辑回归

目录 逻辑回归理解损失函数代码练习1. 房屋价格与面积的关系2.基于学生特征的录取概率预测 逻辑回归理解 逻辑回归是用来二分类的&#xff01; 是在线性回归模型之后加了一个激活函数&#xff08;Sigmoid)将预测值归一化到【0~1】之间&#xff0c;变成概率值。 一般计算其中一…

2023 年“泰迪杯”数据分析技能赛B 题企业财务数据分析与造假识别

2023 年“泰迪杯”数据分析技能赛B 题企业财务数据分析与造假识别 一、背景 财务数据是指企业经营活动和财务结果的数据记录&#xff0c;反映了企业的财务状况 与经营成果。对行业、企业的财务数据进行分析&#xff0c;就是要评价其过去的经营业绩、 衡量现在的财务状况、预测…

【Android】View的工作流程——measure

1.View的工作流程入口 1.1DecorView被加载到Window中 看到这里你对Activity的构成有一定的了解&#xff0c;每个 Activity 都有一个与之关联的 Window 对象&#xff0c;而 DecorView 是这个 Window 的根视图。当DecorView被创建以及加载资源的时候&#xff0c;此时它的内容还…

4.opengl中变换

变换 1.向量 向量有一个方向(Direction)和大小(Magnitude&#xff0c;也叫做强度或长度)。 数学家喜欢在字母上面加一横表示向量&#xff0c;比如说vv。当用在公式中时它们通常是这样的&#xff1a; 1.1.向量相乘 1.1.1.点乘 我们该如何计算点乘呢&#xff1f;点乘是通过将…

聊聊开发一个接口用到哪些Swagger 注解

文章目录 常用swagger注解类注解方法注解字段注解 Swagger配置引入依赖编写配置类静态资源映射访问swagger ui 为什么要聊Swagger呢&#xff0c;原因是我发现实际开发中前端同事每次都需要问我枚举是什么&#xff0c;经过反思&#xff0c;我觉得是接口文档写的不够好。所以整理…

【Nginx系列】多个路径指向一个地址

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…