From 48d5ab35c3fcdc6edca1278d1474a1b54a431191 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期三, 21 八月 2024 16:00:33 +0800 Subject: [PATCH] bug修改 --- src/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue | 8 ++-- src/views/homePage.vue | 1 src/views/hazardousChemicals/systemManage/department/index.vue | 9 ++-- src/views/hazardousChemicals/accessRecords/components/rawTable.vue | 25 +++++++++++- src/views/hazardousChemicals/systemManage/user/components/userDialog.vue | 15 +++++-- src/layout/components/Navbar.vue | 12 ++++-- src/views/hazardousChemicals/homePage/index.vue | 5 ++ src/views/components/flowDetail.vue | 14 +++++-- 8 files changed, 65 insertions(+), 24 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index b8c655c..bfde884 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -52,7 +52,7 @@ import {getToken, removeToken} from "@/utils/auth"; import {onMounted, ref} from "vue"; import Cookies from "js-cookie"; -import {getUserById} from "@/api/sysUsers"; +import {getUserById} from "@/api/hazardousChemicals/user"; import menu from "@/layout/components/Sidebar/menu"; import userDialog from '@/views/hazardousChemicals/systemManage/user/components/userDialog.vue' @@ -92,9 +92,13 @@ } } -function getInfo() { - console.log("getInfo",userInfo.value) - reviewRef.value.openDialog('view',userInfo.value) +const getInfo = async () => { + const info = await getUserById(userInfo.value.id); + if(info.code === 200){ + Cookies.set('userInfo',JSON.stringify(info.data)) + reviewRef.value.openDialog('edit',info.data) + } + } function editPsd() { reviewRef.value.openDialog('pwd',userInfo.value) diff --git a/src/views/components/flowDetail.vue b/src/views/components/flowDetail.vue index a0dcc6e..c8133fb 100644 --- a/src/views/components/flowDetail.vue +++ b/src/views/components/flowDetail.vue @@ -17,6 +17,8 @@ :hollow="item.hollow" > {{ item.description }} + <span style="color: #03752e;font-weight: 600" v-if="item.num > 0">{{item.stateName}}</span> + <span style="color: #f6828e;font-weight: 600" v-else>{{item.stateName}}</span> <span style="color: #03752e" v-if="item.num > 0">{{item.num >0 ? '+' + item.num: item.num}}{{item.unit}}</span> <span style="color: #f6828e" v-else>{{item.num}}{{item.unit}}</span> </el-timeline-item> @@ -80,7 +82,8 @@ return { ...item, unit: item.productBasic.unit, - description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ${item.state == 0 ? '批量导入' : item.state == 3 ? '标签作废' : '销售'}`, + stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '', + description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 `, size: 'large', type: 'primary', icon: MoreFilled, @@ -114,7 +117,8 @@ return { ...item, unit:item.hazmatBasic.unit, - description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ${item.state ==0?'批量导入': item.state ==1?'取用' :item.state ==2?'归还':item.state ==3?'标签作废' :''}`, + stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '', + description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 `, size: 'large', type: 'primary', icon: MoreFilled, @@ -142,7 +146,8 @@ return { ...item, unit:item.hazmatBasic.unit, - description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ${item.state ==0?'批量导入': item.state ==1?'取用' :item.state ==2?'归还':item.state ==3?'标签作废' :''}`, + stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '', + description: `${item.updateTime} ${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 `, size: 'large', type: 'primary', icon: MoreFilled, @@ -157,7 +162,8 @@ return { ...item, unit:item.productBasic.unit, - description: `${item.updateTime} ${item.user.departName? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ${item.state == 0 ? '批量导入' : item.state == 3 ? '标签作废' : '销售'}`, + stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '', + description: `${item.updateTime} ${item.user.departName? item.user.departName +'部门' : ''} ${item.user.name} 进行了 `, size: 'large', type: 'primary', icon: MoreFilled, diff --git a/src/views/hazardousChemicals/accessRecords/components/rawTable.vue b/src/views/hazardousChemicals/accessRecords/components/rawTable.vue index 4e7c531..891ae47 100644 --- a/src/views/hazardousChemicals/accessRecords/components/rawTable.vue +++ b/src/views/hazardousChemicals/accessRecords/components/rawTable.vue @@ -22,7 +22,7 @@ </el-form> </div> <!-- 表格数据 --> - <el-table v-loading="loading" :data="dataList" :border="true"> + <el-table v-loading="loading" :data="dataList" :border="true" :cell-style="cellStyle"> <el-table-column label="序号" type="index" align="center" width="80" /> <el-table-column label="流转时间" prop="updateTime" align="center" width="120"/> <el-table-column label="品名" prop="hazmatBasic.name" align="center" /> @@ -112,7 +112,6 @@ } getList() }) - const getList = async () => { loading.value = true const res = await getRawFlow(data.queryParams) @@ -185,6 +184,28 @@ const getProRecord = (val) => { dialogRef.value.openDialog(val) } +const cellStyle = ({ row, column,rowIndex, columnIndex }) => { + let arr = [] + if (data.dataList !== null) { + data.dataList.filter((item, index) => { + arr.push(item.basicId) + }) + } + + for (let i = 0; i <= arr.length; i++) { + if (arr[i] == row.basicId) { + if (columnIndex === 6 || columnIndex === 5){ + if(row.num > 0){ + return { color:' green' } + }else{ + return { color:' red' } + } + + } + + } + } +}; defineExpose({ getList diff --git a/src/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue b/src/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue index a8d90a8..bea1c50 100644 --- a/src/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue +++ b/src/views/hazardousChemicals/electronicWarehouse/components/viewQR.vue @@ -12,10 +12,10 @@ </div> <el-card style="max-width: 480px"> <div :id="state.form.code"> - <div style="display: flex;flex-direction: column;align-items: center;font-size: 16px;"> - <span>{{title}}</span> - <vue-qr :size="85" :margin="0" :auto-color="true" :dot-scale="1" :text="state.form.code" style="margin: 10px 0 10px 0"></vue-qr> - <span>{{state.form.code}}</span> + <div style="display: flex;flex-direction: column;align-items: center;"> + <span style="font-size:14px;margin-top:10px;">{{title}}</span> + <vue-qr :size="80" :margin="0" :auto-color="true" :dot-scale="1" :text="state.form.code" style="margin: 10px 0 5px 0"></vue-qr> + <span style="font-size:10px;margin-top:5px;">{{state.form.code}}</span> </div> </div> </el-card> diff --git a/src/views/hazardousChemicals/homePage/index.vue b/src/views/hazardousChemicals/homePage/index.vue index 7c6eed3..24cc320 100644 --- a/src/views/hazardousChemicals/homePage/index.vue +++ b/src/views/hazardousChemicals/homePage/index.vue @@ -54,6 +54,8 @@ <img :src="avator" style="width: 25px;height: 25px" /> <div style="display: flex;flex-direction: column;margin-left: 20px"> <span style="font-size: 16px;font-weight: 600">{{item.description}} + <span style="color: #03752e;font-weight: 600" v-if="item.num > 0">{{item.stateName}}</span> + <span style="color: #f6828e;font-weight: 600" v-else>{{item.stateName}}</span> <span style="color: #03752e" v-if="item.num > 0">{{item.num >0 ? '+' + item.num: item.num}}{{item.unit}}</span> <span style="color: #f6828e" v-else>{{item.num}}{{item.unit}}</span> </span> @@ -200,7 +202,8 @@ return { ...item, unit:item.hazmatBasic.unit, - description: `${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ${item.state ==0?'批量导入': item.state ==1?'取用' :item.state ==2?'归还':item.state ==3?'标签作废' :''} ${item.hazmatBasic.name}` + stateName: item.state ==0 ?'入库': item.state ==1 ? '取用' :item.state ==2 ? '归还': item.state ==3 ? '标签作废' : item.state ==4 ? '用尽登记':item.state ==5 ? '销售' : '', + description: `${item.user.departName ? item.user.departName +'部门' : ''} ${item.user.name} 进行了 ` } }) console.log('data.hazmatData',data.hazmatData) diff --git a/src/views/hazardousChemicals/systemManage/department/index.vue b/src/views/hazardousChemicals/systemManage/department/index.vue index 320cb2a..8568e91 100644 --- a/src/views/hazardousChemicals/systemManage/department/index.vue +++ b/src/views/hazardousChemicals/systemManage/department/index.vue @@ -23,11 +23,12 @@ <span>{{scope.row.status ==0 ? '正常' : '停用'}}</span> </template> </el-table-column> - <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250" > + <el-table-column label="操作" align="center" width="250" > + <template #default="scope"> - <el-button type="success" plain @click="openDialog('add',scope.row)">添加</el-button> - <el-button type="primary" plain @click="openDialog('edit',scope.row)">编辑</el-button> - <el-button type="danger" plain @click="handleDelete(scope.row.id)">删除</el-button> + <el-button type="success" link @click="openDialog('add',scope.row)">添加</el-button> + <el-button type="primary" link @click="openDialog('edit',scope.row)">编辑</el-button> + <el-button type="danger" link @click="handleDelete(scope.row.id)">删除</el-button> </template> </el-table-column> </el-table> diff --git a/src/views/hazardousChemicals/systemManage/user/components/userDialog.vue b/src/views/hazardousChemicals/systemManage/user/components/userDialog.vue index fe4088d..9492f5a 100644 --- a/src/views/hazardousChemicals/systemManage/user/components/userDialog.vue +++ b/src/views/hazardousChemicals/systemManage/user/components/userDialog.vue @@ -64,9 +64,9 @@ </el-select> <el-input v-else disabled style="width: 100%" v-model="state.form.companyName"></el-input> </el-form-item> - <el-form-item label="所属部门:" prop="departId" v-if="state.form.userType !=0" > + <el-form-item label="所属部门:" prop="departId" v-if="state.form.userType !=0 && state.title !== '修改密码'" > <el-cascader - v-if="(state.currentUserType == 1 ||state.currentUserType == 0) && (state.title == '新增用户' || state.title == '编辑用户')" + v-if="state.title == '新增用户' || state.title == '编辑用户'" style="width: 100%" ref="classifyRef" v-model="state.form.departId" @@ -218,6 +218,7 @@ const userInfo = ref() const classifyRef = ref(null) const openDialog = async (type, value) => { + userInfo.value = JSON.parse(Cookies.get('userInfo')) console.log("userInfo",userInfo.value) state.currentUserType = userInfo.value.userType @@ -229,10 +230,11 @@ state.form.companyName = userInfo.value.companyName; state.form.userType = 2 } - if(userInfo.value.userType != 0 || (userInfo.value.userType ==0 && (type =='edit' || state.title =='查看用户'))){ + + state.title = type === 'add' ? '新增用户' : type ==='edit' ? '编辑用户' : type ==='pwd' ? '修改密码' : '查看用户' ; + if(state.title !== '修改密码' && (userInfo.value.userType != 0 || (userInfo.value.userType ==0 && (type =='edit' || state.title =='查看用户')))){ await getDeptList() } - state.title = type === 'add' ? '新增用户' : type ==='edit' ? '编辑用户' : type ==='pwd' ? '修改密码' : '查看用户' ; if(type === 'edit' || type === 'view') { startUsername.value = value.username if( type === 'view'){ @@ -241,7 +243,8 @@ if(type === 'edit' && state.isAdmin){ await getCompanyList("") } - state.form = value + + state.form = JSON.parse(JSON.stringify(value)); } if(type == 'pwd'){ state.form.id = value.id @@ -344,6 +347,8 @@ data.password = Base64.encode(data.password) const res = await editUser(data) if(res.code == 200){ + + // Cookies.set('userInfo',JSON.stringify(data)) ElMessage.success(res.message) emit('getList') handleClose() diff --git a/src/views/homePage.vue b/src/views/homePage.vue index c4d5b42..f6e987b 100644 --- a/src/views/homePage.vue +++ b/src/views/homePage.vue @@ -331,6 +331,7 @@ //background-repeat: no-repeat; background-size: cover; height: 100%; + min-height: 931px; :deep(.el-form-item__content .el-form-item) { display: block; } -- Gitblit v1.9.2