增加当前登录人自动填充

This commit is contained in:
yinjinlu-pc\尹金路 2024-12-26 17:45:04 +08:00
parent 7516bdbfb8
commit bdfe24349b
2 changed files with 37 additions and 8 deletions

View File

@ -6,6 +6,8 @@ const user = {
token: getToken(),
name: '',
avatar: '',
id: '',
nick: '',
roles: [],
permissions: []
},
@ -20,6 +22,12 @@ const user = {
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
SET_ID: (state, id) => {
state.id = id
},
SET_NICK: (state, nick) => {
state.nick = nick
},
SET_ROLES: (state, roles) => {
state.roles = roles
},
@ -58,6 +66,8 @@ const user = {
} else {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_ID', user.userId)
commit('SET_NICK', user.nickName)
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
resolve(res)

View File

@ -99,7 +99,7 @@
<el-table-column label="规格型号" align="center" prop="machinerySpec" />
<el-table-column label="计划编码" align="center" prop="planCode" />
<el-table-column label="计划名称" align="center" prop="planName" />
<el-table-column lable="点检人" align="center" prop="nickName" />
<el-table-column label="点检人" align="center" prop="nickName" />
<el-table-column label="点检时间" align="center" prop="checkTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.checkTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -172,17 +172,20 @@
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请选择设备点检计划" >
<el-form-item label="点检计划" prop="planName">
<el-input v-model="form.planName" placeholder="请选择设备点检计划" >
<el-button slot="append" @click="handleSelectPlan" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<CheckplanSelect ref="checkplanSelect" planType="CHECK" @onSelected="onPlanAdd"></CheckplanSelect>
</el-col>
<el-col :span="8">
<el-form-item label="计划名称" prop="planName">
<el-input v-model="form.planName" readonly="readonly" placeholder="请输入计划名称" />
<el-form-item label="点检人" prop="nickName">
<el-input v-model="form.nickName" placeholder="请选择点检人" >
<el-button slot="append" @click="handleUserSelect" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<UserSingleSelect ref="userSelect" @onSelected="onUserSelected"></UserSingleSelect>
</el-col>
<el-col :span="8">
<el-form-item label="点检时间" prop="checkTime">
@ -222,10 +225,11 @@ import { listCheckrecord, getCheckrecord, delCheckrecord, addCheckrecord, update
import MachinerySelectSingle from "@/components/machinerySelect/single.vue";
import CheckplanSelect from "@/components/dvplanSelect/index.vue";
import CheckRecordLine from "./line.vue";
import UserSingleSelect from "@/components/userSelect/single.vue"
export default {
name: "Checkrecord",
dicts: ['mes_order_status'],
components:{ MachinerySelectSingle, CheckplanSelect, CheckRecordLine },
components:{ MachinerySelectSingle, CheckplanSelect, CheckRecordLine, UserSingleSelect},
data() {
return {
optType: null,
@ -287,7 +291,10 @@ export default {
//
reset() {
this.form = {
recordId: null, planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, machinerySpec: null, checkTime: new Date(), status: "PREPARE", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
recordId: null, planId: null, planCode: null, planName: null, planType: null, machineryId: null, machineryCode: null, machineryName: null, machineryBrand: null, userId: null, nickName: null, userName: null, machinerySpec: null, checkTime: new Date(), status: "PREPARE", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
this.form.userId= this.$store.state.user.id;
this.form.nickName= this.$store.state.user.nick;
this.form.userName= this.$store.state.user.name;
this.resetForm("form");
},
/** 搜索按钮操作 */
@ -404,6 +411,18 @@ export default {
this.form.planType = obj.planType;
}
},
//
handleUserSelect(){
this.$refs.userSelect.showFlag = true;
},
//
onUserSelected(row){
this.form.userId = row.userId;
this.form.nickName = row.nickName;
this.form.userName = row.userName;
},
/** 导出按钮操作 */
handleExport() {
this.download('dv/checkrecord/export', {