Browse Source

入库,出库,归还。登录退出

master
zhang_li 9 months ago
parent
commit
5a17bdbba7
  1. 24
      api/inLocation.js
  2. 16
      api/location.js
  3. 25
      api/outLocation.js
  4. 18
      api/spareParts.js
  5. 9
      api/sparePartsReturn.js
  6. 42
      api/system/user.js
  7. 8
      api/user.js
  8. 2
      config.js
  9. 3
      manifest.json
  10. 75
      pages.json
  11. 502
      pages/inLocation/addForm.vue
  12. 145
      pages/inLocation/index.vue
  13. 257
      pages/index.vue
  14. 6
      pages/login.vue
  15. 479
      pages/outLocation/addForm.vue
  16. 161
      pages/outLocation/index.vue
  17. 478
      pages/sparePartsReturn/addForm.vue
  18. 3
      plugins/index.js
  19. 19
      plugins/time.js
  20. BIN
      static/images/icon1.png
  21. BIN
      static/images/icon2.png
  22. BIN
      static/images/icon3.png
  23. 86
      store/modules/user.js
  24. 6
      utils/constant.js
  25. 2
      utils/storage.js

24
api/inLocation.js

@ -0,0 +1,24 @@
import request from '@/utils/request'
// 获取采购订单分页列表
export function getInLocationPage(params) {
return request({
url: '/eam/item-order-main/getPdaPage',
'method': 'GET',
params
})
}
// 获取采购订单分页列表
export function getInLocationDetail(id) {
return request({
url: '/eam/item-order-main/getPdaDetailsById?id='+id,
'method': 'GET',
})
}
// 入库新增
export function inLocationCreat(data) {
return request({
url: '/eam/item-order-main/inOperation',
'method': 'POST',
data
})
}

16
api/location.js

@ -0,0 +1,16 @@
import request from '@/utils/request'
// 获取库位
export function getLocation(number) {
return request({
url: '/eam/location/scanCodeByNumber?number='+number,
'method': 'GET',
})
}
// 出库获取库位
export function getOutLocation(params) {
return request({
url: '/eam/location/outScanCodeByNumber',
'method': 'GET',
params
})
}

25
api/outLocation.js

@ -0,0 +1,25 @@
import request from '@/utils/request'
// 获取领用出库分页列表
export function getOutLocationPage(params) {
return request({
url: '/eam/item-apply-main/getAppOutOperaPage',
'method': 'GET',
params
})
}
// 获取领用出库详情
export function getOutLocationDetail(params) {
return request({
url: '/eam/item-apply-main/appGetByNumber',
'method': 'GET',
params
})
}
// 出库新增
export function outLocationCreat(data) {
return request({
url: '/eam/item-apply-main/outOperation',
'method': 'POST',
data
})
}

18
api/spareParts.js

@ -0,0 +1,18 @@
import request from '@/utils/request'
// 获取备件信息
export function getSparePartsInfo(params) {
return request({
url: '/eam/item/inScanCodeByNumber',
'method': 'GET',
params
})
}
// 备件归还获取备件信息
export function getSparePartsReturnInfo(params) {
return request({
url: '/eam/item/scanCodeByNumber',
'method': 'GET',
params
})
}

9
api/sparePartsReturn.js

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 归还
export function sparePartsReturn(data) {
return request({
url: '/eam/item-apply-main/inOperation',
'method': 'POST',
data
})
}

42
api/system/user.js

@ -1,42 +0,0 @@
import upload from '@/utils/upload'
import request from '@/utils/request'
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
const data = {
oldPassword,
newPassword
}
return request({
url: '/system/user/profile/update-password',
method: 'PUT',
params: data
})
}
// 查询用户个人信息
export function getUserProfile() {
return request({
url: '/system/user/profile/get',
method: 'GET'
})
}
// 修改用户个人信息
export function updateUserProfile(data) {
return request({
url: '/system/user/profile/update',
method: 'PUT',
data: data
})
}
// 用户头像上传
export function uploadAvatar(data) {
return upload({
url: '/system/user/profile/update-avatar',
method: 'PUT',
name: data.name,
filePath: data.filePath
})
}

8
api/user.js

@ -0,0 +1,8 @@
import request from '@/utils/request'
// 归还人员
export function getReverterUser(){
return request({
url: '/system/user/list-all-simple',
'method': 'GET'
})
}

2
config.js

@ -1,6 +1,6 @@
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
baseUrl: process.env.NODE_ENV === 'development' ? 'http://localhost:12080' : 'http://dev.ccwin-in.com:25200/api', baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.1.18:12080' : 'http://dev.ccwin-in.com:12080/api',
baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api', baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api',
// 应用信息 // 应用信息
appInfo: { appInfo: {

3
manifest.json

@ -39,7 +39,8 @@
"dSYMs" : false "dSYMs" : false
}, },
"sdkConfigs" : { "sdkConfigs" : {
"ad" : {} "ad" : {},
"push" : {}
} }
} }
}, },

75
pages.json

@ -2,41 +2,50 @@
"pages": [{ "pages": [{
"path": "pages/index", "path": "pages/index",
"style": { "style": {
"navigationBarTitleText": "首页" "navigationBarTitleText": "首页",
"navigationStyle": "custom"
}
},{
"path": "pages/login",
"style": {
"navigationStyle": "custom"
}
},{
"path": "pages/inLocation/index",
"style": {
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/inLocation/addForm",
"style": {
"navigationBarTitleText": "入库信息",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsReturn/addForm",
"style": {
"navigationBarTitleText": "备件归还",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/outLocation/index",
"style": {
"navigationStyle": "custom",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/outLocation/addForm",
"style": {
"navigationBarTitleText": "出库信息",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
} }
}], }],
// "tabBar": {
// "color": "#8f9bb3",
// "selectedColor": "#409eff",
// "borderStyle": "white",
// "backgroundColor": "#ffffff",
// "list": [{
// "pagePath": "pages/index",
// "iconPath": "static/images/tabbar/tab_icon1.png",
// "selectedIconPath": "static/images/tabbar/tab_act_icon1.png",
// "text": "首页"
// }, {
// "pagePath": "pages/device/index",
// "iconPath": "static/images/tabbar/tab_icon2.png",
// "selectedIconPath": "static/images/tabbar/tab_act_icon2.png",
// "text": "设备"
// }, {
// "pagePath": "pages/mold/index",
// "iconPath": "static/images/tabbar/tab_icon3.png",
// "selectedIconPath": "static/images/tabbar/tab_act_icon3.png",
// "text": "模具"
// }, {
// "pagePath": "pages/spareParts/index",
// "iconPath": "static/images/tabbar/tab_icon4.png",
// "selectedIconPath": "static/images/tabbar/tab_act_icon4.png",
// "text": "备件"
// }, {
// "pagePath": "pages/mine/index",
// "iconPath": "static/images/tabbar/tab_icon5.png",
// "selectedIconPath": "static/images/tabbar/tab_act_icon5.png",
// "text": "我的"
// }]
// },
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "RuoYi", "navigationBarTitleText": "RuoYi",

502
pages/inLocation/addForm.vue

@ -0,0 +1,502 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="批次号" prop="number" required>
<u-input v-model="form.number" placeholder="请输入批次号" />
</u-form-item>
<u-form-item label="供应商" prop="supplierName" required>
<u-input v-model="form.supplierName" placeholder="请输入供应商" />
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span>*</span>订单信息
</view>
<view class="item " v-for="(item,index) in orderList" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.itemName}}
</view>
</view>
<u-row gutter="16">
<!-- <u-col :span="24">
<view class="dec">
库位{{item.locationNumber}}
</view>
</u-col> -->
<u-col :span="24">
<view class="dec">
已入库数量:{{item.deliveryQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
采购数量:{{item.qty}}
</view>
</u-col>
</u-row>
</view>
</view>
</view>
<view class="list">
<view class="title">
<span>*</span>申请备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.itemName}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec">
入库数量{{item.qty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
采购数量{{item.applyQty}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1" label-width="160rpx">
<u-form-item :label="`备件编号`" prop="itemNumber" required>
<view class="select">
<u-input v-model="form1.itemNumber" placeholder="请选择备件" @blur="blur1" />
<view class="right-button" @click="chickRightButton1">
扫描
</view>
</view>
</u-form-item>
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled">
<view class="select">
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled />
</view>
</u-form-item>
<u-form-item label="库位" prop="locationNumber" required v-if="isShow">
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" />
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item label="采购数量" prop="applyQty" required class="disabled">
<u-input v-model="form1.applyQty" type="number" disabled placeholder="请输入采购数量" />
</u-form-item>
<u-form-item label="已入库数量" prop="deliveryQty" required class="disabled">
<u-input v-model="form1.deliveryQty" type="number" disabled placeholder="请输入已入库数量" />
</u-form-item>
<u-form-item label="入库数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入入库数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
</view>
</template>
<script>
import * as inLocationApi from "@/api/inLocation.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as locationApi from "@/api/location.js"
export default {
data() {
return {
loading: false,
orderList: [], //
//
isPopupShow: false,
field: '',
form: {
id: '',
number: '',
itemNumbers: []
},
form1: {
itemNumber: "",
itemName: '',
locationNumber: '',
applyQty: '',
deliveryQty: '',
qty: ''
},
isShow: false,
isInAccount: 'FALSE'
}
},
methods: {
//
submit() {
//
// if (!this.form.name) {
// this.$modal.showToast('')
// return;
// }
if (this.form.itemNumbers.length === 0) {
this.$modal.showToast('请选择备件')
return;
}
this.$modal.confirm('是否添加入库信息').then(() => {
this.$modal.loading('加载中')
this.loading = true
inLocationApi.inLocationCreat(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
async getInLocationDetail() {
await inLocationApi.getInLocationDetail(this.form.id).then(res => {
this.orderList = res.data
})
},
//
open() {
this.form1 = {
itemNumber: "",
itemName: '',
locationNumber: '',
applyQty: '',
deliveryQty: '',
qty: ''
}
this.isPopupShow = true
this.isShow= false
},
//
addSpare() {
//
if (!this.form1.itemNumber) {
this.$modal.showToast('请选择备件')
return;
}
if (!this.form1.itemName) {
this.$modal.showToast('找不到该备件')
return;
}
if (!this.form1.locationNumber) {
this.$modal.showToast('请选择库位')
return;
}
if (this.isInAccount == 'FALSE') {
this.$modal.showToast('该库位属于帐外库,请选择帐内库')
return;
}
if (this.itemNumber) {
this.$modal.showToast('该库位已绑定过备件')
return;
}
if (!this.form1.qty) {
this.$modal.showToast(`请输入数量`)
return;
}
console.log(this.form1)
if (Number(this.form1.qty) + Number(this.form1.deliveryQty) > Number(this.form1.applyQty)) {
this.$modal.showToast('已入库数量和入库数量不可大于采购数量')
return;
}
if (this.form.itemNumbers && this.form.itemNumbers.length > 0) {
let arr = this.form.itemNumbers.filter(item => item.itemNumber == this.form1.itemNumber)
if (arr && arr.length > 0) {
this.$modal.showToast('该备件已添加')
return;
}
let arr1 = orderList.filter(item => item.itemNumber == this.form1.itemNumber)
if (!arr1|| (arr1&&arr1.length == 0)) {
this.$modal.showToast('订单信息没有该备件')
return;
}
}
this.form.itemNumbers.push(this.form1)
this.isPopupShow = false
},
//
delSpareParts(index) {
this.form.itemNumbers.splice(index, 1)
},
getLocation() {
locationApi.getLocation(this.form1.locationNumber).then(res => {
if(!res.data){
this.$modal.showToast('找不到该库位')
return;
}
this.form1.areaNumber = res.data.areaNumber;
this.isInAccount = res.data.isInAccount || ''
this.itemNumber = res.data.itemNumber || ''
})
},
blur() {
if (this.form1.locationNumber) {
this.getLocation()
}
},
//
getSparePartsInfo() {
sparePartsApi.getSparePartsInfo({
number: this.form1.itemNumber,
id: this.form.id
}).then(res => {
if(!res.data){
this.$modal.showToast('找不到该备件')
this.itemNumber = ''
this.form1.areaNumber = ''
this.form1.locationNumber = '';
this.isInAccount = ''
this.form1.itemName = ''
return;
}
this.itemNumber = ''
this.form1.areaNumber = res.data.areaNumber || ''
this.form1.locationNumber = res.data.locationNumber;
this.isInAccount = res.data.isInAccount|| ''
this.form1.itemName = res.data.itemName
this.form1.deliveryQty = res.data.deliveryQty
this.form1.applyQty = res.data.applyQty
if (!this.form1.locationNumber) {
this.isShow = true
}
})
},
blur1() {
if (this.form1.itemNumber) {
this.getSparePartsInfo()
}
},
},
async onLoad(option) {
// if (option.id) this.form.id = option.id;
// if (option.number) this.form.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
let form = JSON.parse(decodeURIComponent(option.data))
this.form.supplierName =form.supplierName
this.form.number =form.number
this.form.id =form.id
}
await this.getInLocationDetail()
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0rpx;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
top: 19px;
}
}
.list {
padding: 0rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 0rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

145
pages/inLocation/index.vue

@ -0,0 +1,145 @@
<template>
<!-- 采购入库 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="采购入库">
</u-navbar>
<!-- <Search @search='search' @screen='screen' /> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.number}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
采购人:<span>{{item.purchaser}}</span>
</view>
<view class="dec">
采购时间:<span>{{item.date}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="未完成" v-if="item.status=='INCOMPLETE'" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="已完成" v-else-if="item.status=='COMPLETE'" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
</view>
</view>
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as inLocationApi from "@/api/inLocation.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
},
status: 'loadmore', //
list: [],
}
},
methods: {
openDetail(item){
this.$tab.navigateTo(`/pages/inLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`)
},
//
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await inLocationApi.getInLocationPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
console.log(this.list )
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

257
pages/index.vue

@ -3,134 +3,68 @@
<u-navbar back-icon-color='#fff' back-icon-name='' <u-navbar back-icon-color='#fff' back-icon-name=''
:background="{ background: 'rgba(64, 158,255,'+bgOpacity+')'}" back-text="" title-color='#fff' :background="{ background: 'rgba(64, 158,255,'+bgOpacity+')'}" back-text="" title-color='#fff'
:immersive='true' :border-bottom='false' title="首页"> :immersive='true' :border-bottom='false' title="首页">
<!-- <template v-slot:right>
<u-icon name="bell" color="#fff" size="36" style="padding-right: 30rpx;"
@click="open('/pages/notaic/index')"></u-icon>
</template> -->
</u-navbar> </u-navbar>
<view class="top"> <view class="top">
<image src="../static/images/mobile_bg.png" class="bg" mode=""></image> <image src="../static/images/mobile_bg.png" class="bg" mode=""></image>
<view class="top-box"> <view class="top-box" v-if="token">
<view class="number"> <view class="info">
<view class="number-item"> <image :src="$store.state.user.avatar" class="cu-avatar" mode="" v-if="$store.state.user"></image>
<view>{{counts.allCount || 0}}</view> <view class="cu-avatar" v-else>
<view>设备总数</view> <u-icon name="account-fill" color="#ababab" size="100"></u-icon>
</view> </view>
<view class="number-item">
<view>{{counts.breakDownCount || 0}}</view> <view class="user-info">
<view>故障中设备</view> <view class="name" v-if="$store.state.user.name">{{$store.state.user.name}} <span v-if="$store.state.user.post">{{$store.state.user.post.name}}</span></view>
</view> <view class="tips" v-if="$store.state.user.dept">{{$store.state.user.dept.name}}</view>
<view class="number-item">
<view>{{counts.repairCount || 0}}</view>
<view>已报修设备</view>
</view> </view>
</view> </view>
<view class="status">
<view class="status-item">
<view>{{counts1.gongdan || 0}}</view>
<view>待接单</view>
</view> </view>
<view class="status-item"> <view class="top-box" v-else>
<view>{{counts1.yanzheng || 0}}</view> <view class="info">
<view>待验证</view> <view class="cu-avatar">
<u-icon name="account-fill" color="#ababab" size="100"></u-icon>
</view> </view>
<view class="status-item">
<view>{{counts1.shenpi || 0}}</view> <view class="user-info" @click="handleLogin">
<view>待审核</view> <view class="name">点击登录</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="box"> <view class="box">
<view class="" v-if=" $store.state.user.classType == 'DEVICE' || $store.state.user.classType == 'TECH' || !$store.state.user.classType"> <view class="">
<view class="title">设备维护</view> <view class="title">采购入库</view>
<u-row gutter="16" style="padding:0px 20rpx ;"> <u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3"> <u-col span="3">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=DEVICE')"> <view class="icon-item" @click="open('/pages/inLocation/index')">
<image src="../static/images/icon4.svg" mode=""></image> <image src="../static/images/icon1.png" mode=""></image>
<view>设备报修</view> <view>采购入库</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/repairOrder/index?type=DEVICE')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=DEVICE')">
<image src="../static/images/icon3.svg" mode=""></image>
<view>检修工单</view>
</view> </view>
</u-col> </u-col>
<u-col span="3"> <u-col span="3">
<view class="icon-item" @click="open('/pages/spotCheckOrder/addForm?type=DEVICE')"> <view class="icon-item" @click="open('/pages/sparePartsReturn/addForm')">
<image src="../static/images/icon2.svg" mode=""></image> <image src="../static/images/icon3.png" mode=""></image>
<view>点检工单</view> <view>备件归还</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/upkeepOrder/index?type=DEVICE')">
<image src="../static/images/icon1.svg" mode=""></image>
<view>保养工单</view>
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
</view> </view>
<view class="" v-if="$store.state.user.classType == 'MOLD' "> <view class="">
<view class="title">模具维护</view> <view class="title">出库</view>
<u-row gutter="16"> <u-row gutter="16">
<u-col span="3"> <u-col span="3">
<view class="icon-item" @click="open('/pages/deviceReport/index?type=MOLD')"> <view class="icon-item" @click="open('/pages/outLocation/index')">
<image src="../static/images/icon4.svg" mode=""></image> <image src="../static/images/icon2.png" mode=""></image>
<view>设备报修</view> <view>领用出库</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/repairOrder/index?type=MOLD')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=MOLD')">
<image src="../static/images/icon2.svg" mode=""></image>
<view>检修工单</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/maintenWorkOrderList/index')">
<image src="../static/images/icon1.svg" mode=""></image>
<view>保养工单</view>
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
</view> </view>
<view class="title">备件管理</view>
<u-row gutter="16">
<u-col span="3" v-if=" $store.state.user.role == 'all_approve' || $store.state.user.role == 'normal_approve'">
<view class="icon-item" @click="open('/pages/sparePartsApplicationApprove/index')">
<image src="../static/images/icon6.png" mode=""></image>
<view>领用申请审批</view>
</view>
</u-col>
<u-col span="3" v-else>
<view class="icon-item" @click="open('/pages/sparePartsApplication/index')">
<image src="../static/images/icon6.png" mode=""></image>
<view>领用申请</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/sparePartsServiceWorkOrderList/addForm?type=DEVICE')">
<image src="../static/images/icon5.svg" mode=""></image>
<view>维修工单</view>
</view>
</u-col>
</u-row>
</view> </view>
<view class="btn" @click="handleLogout" v-if="token">退出登录</view>
</view> </view>
</template> </template>
@ -150,31 +84,34 @@
data() { data() {
return { return {
bgOpacity: 0, bgOpacity: 0,
counts: '', token: '',
counts1: '',
} }
}, },
methods: { methods: {
open(url) { open(url) {
if(!this.token){
this.$tab.navigateTo('/pages/login')
return
}
this.$tab.navigateTo(url) this.$tab.navigateTo(url)
}, },
getCounts() { handleLogout() {
getCounts().then(res => { this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.counts = res.data this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/login')
}) })
},
getToDoCountsByUser() {
getToDoCountsByUser().then(res => {
this.counts1 = res.data
}) })
}, },
handleLogin() {
console.log(11)
this.$tab.navigateTo('/pages/login')
},
}, },
onLoad: async function() { onLoad: async function() {
if (getAccessToken()) { // if (getAccessToken()) {
this.getCounts() // }
this.getToDoCountsByUser() this.token = getAccessToken() ? getAccessToken() :''
}
console.log( this.$store.state) console.log( this.$store.state)
}, },
onPageScroll(e) { onPageScroll(e) {
@ -201,84 +138,57 @@ console.log( this.$store.state)
position: relative; position: relative;
image { image {
height: calc(var(--status-bar-height) + 410rpx); height: calc(var(--status-bar-height) + 310rpx);
} }
} }
.top-box { .info {
position: absolute; position: absolute;
width: 100%; top: calc(var(--status-bar-height) + 110rpx);
bottom: 0px; left: 80rpx;
right: 80rpx;
.number {
padding: 30rpx 80rpx 50rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; .cu-avatar {
border: 4rpx solid #eaeaea;
.number-item { width: 140rpx;
text-align: center; height: 140rpx;
border-radius: 50%;
view {
&:nth-child(1) {
color: white;
font-size: 40rpx;
font-weight: bold;
}
&:nth-child(2) { .icon {
color: rgba(255, 255, 255, 0.7); font-size: 80rpx;
font-size: 28rpx;
margin-top: 10rpx;
}
} }
} }
}
.status {
margin: 0px 40rpx;
padding: 40rpx 0rpx;
background: white;
border-radius: 20rpx 20rpx 0px 0px;
display: flex;
align-items: center;
justify-content: space-between;
.status-item { .user-info {
text-align: center; margin-left: 30rpx;
position: relative;
flex: 1;
view { .name {
&:nth-child(1) { line-height: 60rpx;
color: black; font-size: 36rpx;
font-size: 40rpx;
font-weight: bold; font-weight: bold;
} line-height: 60rpx;
margin-right: 20rpx;
color: white;
&:nth-child(2) { span {
color: rgba(0, 0, 0, 0.5); font-weight: normal;
font-size: 28rpx; font-size: 28rpx;
margin-top: 10rpx; padding-left: 20rpx;
} }
} }
&::after { .tips {
content: ""; padding: 10rpx 20rpx;
border-right: 1px solid #dedede; background: #3952ae;
position: absolute; color: white;
height: 60rpx; border-radius: 50rpx;
right: 0px; font-size: 24rpx;
top: 50%; display: inline-block;
margin-top: -30rpx;
}
&:nth-last-child(1)::after {
border: none;
}
} }
} }
} }
.box { .box {
@ -306,4 +216,15 @@ console.log( this.$store.state)
} }
} }
} }
.btn {
width: calc(100vw - 60rpx);
margin: 30rpx auto;
background-color: rgb(64, 158, 255);
color: #FFFFFF;
height: 90rpx;
line-height: 90rpx;
text-align: center;
border-radius: 10rpx;
font-size: 32rpx;
}
</style> </style>

6
pages/login.vue

@ -29,11 +29,11 @@
</view> </view>
</view> </view>
<view class="xieyi text-center"> <!-- <view class="xieyi text-center">
<text class="text-grey1">登录即代表同意</text> <text class="text-grey1">登录即代表同意</text>
<text @click="handleUserAgrement" class="text-blue">用户协议</text> <text @click="handleUserAgrement" class="text-blue">用户协议</text>
<text @click="handlePrivacy" class="text-blue">隐私协议</text> <text @click="handlePrivacy" class="text-blue">隐私协议</text>
</view> </view> -->
</view> </view>
</view> </view>
@ -101,8 +101,10 @@
// //
await this.$store.dispatch('GetPermissionInfo').then(res => { await this.$store.dispatch('GetPermissionInfo').then(res => {
// this.$tab.reLaunch('/pages/index') // this.$tab.reLaunch('/pages/index')
console.log(res)
}) })
await this.$store.dispatch('GetInfo').then(res => { await this.$store.dispatch('GetInfo').then(res => {
console.log(res)
this.$tab.reLaunch('/pages/index') this.$tab.reLaunch('/pages/index')
}) })
} }

479
pages/outLocation/addForm.vue

@ -0,0 +1,479 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="申请人" prop="applyName" required class='disabled'>
<u-input v-model="form.applyName" placeholder="请输入申请人" disabled/>
</u-form-item>
<u-form-item label="申请部门" prop="applyDeptName" required class='disabled'>
<u-input v-model="form.applyDeptName" placeholder="请输入申请部门" disabled/>
</u-form-item>
<u-form-item label="审批人" prop="approveName" required class='disabled'>
<u-input v-model="form.approveName" placeholder="请输入审批人" disabled/>
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span>*</span>申领信息
</view>
<view class="item " v-for="(item,index) in form.subList" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.itemName}}
</view>
</view>
<u-row gutter="16">
<!-- <u-col :span="24">
<view class="dec">
库位{{item.locationNumber}}
</view>
</u-col> -->
<u-col :span="24">
<view class="dec">
已出库数量:{{item.receiveQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
申请数量:{{item.qty}}
</view>
</u-col>
</u-row>
</view>
</view>
</view>
<view class="list">
<view class="title">
<span>*</span>出库信息
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.itemName}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec">
出库数量{{item.qty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
申请数量{{item.applyQty}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1" label-width="160rpx">
<u-form-item label="库位" prop="locationNumber" required>
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" />
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled">
<view class="select">
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled />
</view>
</u-form-item>
<u-form-item label="申请数量" prop="applyQty" required class="disabled">
<u-input v-model="form1.applyQty" type="number" disabled placeholder="请输入申请数量" />
</u-form-item>
<u-form-item label="已出库数量" prop="receiveQty" required class="disabled">
<u-input v-model="form1.receiveQty" type="number" disabled placeholder="请输入已出库数量" />
</u-form-item>
<u-form-item label="库存数量" prop="stockQty" required class="disabled">
<u-input v-model="form1.stockQty" type="number" disabled placeholder="请输入库存数量" />
</u-form-item>
<u-form-item label="出库数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入出库数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
</view>
</template>
<script>
import * as outLocationApi from "@/api/outLocation.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as locationApi from "@/api/location.js"
export default {
data() {
return {
loading: false,
orderList: [], //
//
isPopupShow: false,
field: '',
form: {
id: '',
number: '',
itemNumbers: [],
subList:[]
},
form1: {
itemNumber: "",
itemName: '',
locationNumber: '',
applyQty: '',
receiveQty: '',
stockQty: '',
qty: ''
},
isShow: false,
isInAccount: 'FALSE'
}
},
methods: {
//
submit() {
//
// if (!this.form.name) {
// this.$modal.showToast('')
// return;
// }
if (this.form.itemNumbers.length === 0) {
this.$modal.showToast('请选择备件')
return;
}
this.$modal.confirm('是否添加出库信息').then(() => {
this.$modal.loading('加载中')
this.loading = true
outLocationApi.outLocationCreat(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
async getInLocationDetail() {
await outLocationApi.getOutLocationDetail({
id:this.form.id,
number:this.form.number
}).then(res => {
this.form.applyName = res.data.applyName
this.form.approveName = res.data.approveName
this.form.applyDeptName = res.data.applyDeptName
this.form.subList = res.data.subList
})
},
//
open() {
this.form1 = {
itemNumber: "",
itemName: '',
locationNumber: '',
applyQty: '',
receiveQty: '',
stockQty: '',
qty: ''
}
this.isPopupShow = true
this.isShow= false
},
//
addSpare() {
//
if (!this.form1.locationNumber) {
this.$modal.showToast('请选择库位')
return;
}
if (!this.form1.itemNumber) {
this.$modal.showToast('库位没有对应的备件,请重新选择')
return;
}
if (!this.form1.qty) {
this.$modal.showToast(`请输入数量`)
return;
}
console.log(this.form1)
if (Number(this.form1.qty) + Number(this.form1.receiveQty) > Number(this.form1.applyQty)) {
this.$modal.showToast('已出库数量和出库数量不可大于申请数量')
return;
}
if (Number(this.form1.qty) > Number(this.form1.stockQty)) {
this.$modal.showToast('出库数量不可大于库存数量')
return;
}
if (this.form.itemNumbers && this.form.itemNumbers.length > 0) {
let arr = this.form.itemNumbers.filter(item => item.itemNumber == this.form1.itemNumber)
if (arr && arr.length > 0) {
this.$modal.showToast('该备件已添加')
return;
}
let arr1 = this.form.subList.filter(item => item.itemNumber == this.form1.itemNumber)
if (!arr1|| (arr1&&arr1.length == 0)) {
this.$modal.showToast('申领信息没有该备件')
return;
}
}
this.form.itemNumbers.push(this.form1)
this.isPopupShow = false
},
//
delSpareParts(index) {
this.form.itemNumbers.splice(index, 1)
},
getLocation() {
locationApi.getOutLocation({
number:this.form1.locationNumber,
id:this.form.id,
}).then(res => {
if(!res.data){
this.$modal.showToast('找不到该库位')
return;
}
this.form1.areaNumber = res.data.areaNumber;
this.form1.itemName = res.data.itemName;
this.form1.itemNumber = res.data.itemNumber;
this.form1.receiveQty = res.data.receiveQty;
this.form1.applyQty = res.data.applyQty;
this.form1.stockQty = res.data.qty;
this.isInAccount = res.data.isInAccount || ''
// this.itemNumber = res.data.itemNumber || ''
})
},
blur() {
if (this.form1.locationNumber) {
this.getLocation()
}
},
},
async onLoad(option) {
// if (option.id) this.form.id = option.id;
// if (option.number) this.form.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
let form = JSON.parse(decodeURIComponent(option.data))
console.log(form)
this.form.supplierName =form.supplierName
this.form.number =form.number
this.form.id =form.id
}
await this.getInLocationDetail()
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0rpx;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
top: 19px;
}
}
.list {
padding: 0rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 0rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

161
pages/outLocation/index.vue

@ -0,0 +1,161 @@
<template>
<!-- 领用入库 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="领用入库">
</u-navbar>
<!-- <Search @search='search' @screen='screen' /> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.number}}
</view>
<!-- <view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view> -->
</view>
<view class="dec">
申请人:<span>{{item.applyName}}</span>
</view>
<view class="dec">
申请时间:<span>{{`${$time.formatDate(item.createTime)}`}}</span>
</view>
<view class="dec">
申请部门:<span>{{item.applyDeptName}}</span>
</view>
<view class="dec">
审批人:<span>{{item.approveName}}</span>
</view>
<view class="dec">
审批时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
</view>
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as outLocationApi from "@/api/outLocation.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
},
status: 'loadmore', //
list: [],
}
},
methods: {
openDetail(item){
this.$tab.navigateTo(`/pages/outLocation/addForm?data=${encodeURIComponent(JSON.stringify(item))}`)
},
//
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await outLocationApi.getOutLocationPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
console.log(this.list )
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

478
pages/sparePartsReturn/addForm.vue

@ -0,0 +1,478 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<!-- <u-form-item label="入库原因" prop="res" required>
<u-input v-model="form.number" placeholder="请输入入库原因" />
</u-form-item> -->
<u-form-item label="归还人员" prop="reverterName" required>
<view class="select" @click="openSingleColumn('reverterId',form.reverterId,reverterUser)">
<view class="input" v-if='form.reverterId'>
{{selectFormat(form.reverterId,reverterUser)}}
</view>
<view class="placeholder" v-else>
{{`请选择归还人员`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span>*</span>归还备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
备件名称{{item.itemName}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec">
数量{{item.qty}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1" label-width="160rpx">
<u-form-item :label="`备件编号`" prop="itemNumber" required>
<view class="select">
<u-input v-model="form1.itemNumber" placeholder="请选择备件" @blur="blur1" />
<view class="right-button" @click="chickRightButton1">
扫描
</view>
</view>
</u-form-item>
<u-form-item :label="`备件名称`" prop="itemNumber" required class="disabled">
<view class="select">
<u-input v-model="form1.itemName" placeholder="请选择备件" disabled />
</view>
</u-form-item>
<u-form-item label="库位" prop="locationNumber" required v-if="isShow">
<u-input v-model="form1.locationNumber" placeholder="请选择库位" @blur="blur" />
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script>
import * as userApi from "@/api/user.js"
import * as sparePartsReturnApi from "@/api/sparePartsReturn.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as locationApi from "@/api/location.js"
export default {
data() {
return {
loading: false,
//
isPopupShow: false,
//
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
reverterUser:[],
field: '',
form: {
id: '',
number: '',
itemNumbers: []
},
form1: {
itemNumber: "",
itemName: '',
locationNumber: '',
qty: ''
},
isShow: false,
isInAccount: 'FALSE'
}
},
methods: {
//
submit() {
//
if (!this.form.reverterId) {
this.$modal.showToast('请选择归还人员')
return;
}
if (this.form.itemNumbers.length === 0) {
this.$modal.showToast('请选择备件')
return;
}
this.$modal.confirm('是否归还备件').then(() => {
this.$modal.loading('加载中')
this.loading = true
sparePartsReturnApi.sparePartsReturn(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('归还成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('归还失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
this.form[this.field] = e[0].value
if(this.field == 'reverterId'){
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.id == e[0].value)
this.form.reverterName = this.choosesingleColumnItem[0].name
}
this.getApplyDeviceList()
this.singleColumnShow = false
this.$forceUpdate()
},
//
async getReverterUser() {
await userApi.getReverterUser().then(res => {
res.data.map(item => {
item.value = item.id
item.label = item.nickname
})
this.reverterUser = res.data
})
},
//
open() {
this.form1 = {
itemNumber: "",
itemName: '',
locationNumber: '',
qty: ''
}
this.isPopupShow = true
this.isShow= false
},
//
addSpare() {
//
if (!this.form1.itemNumber) {
this.$modal.showToast('请选择备件')
return;
}
if (!this.form1.itemName) {
this.$modal.showToast('找不到该备件')
return;
}
if (!this.form1.locationNumber) {
this.$modal.showToast('请选择库位')
return;
}
if (this.isInAccount == 'TRUE') {
this.$modal.showToast('该库位属于帐内库,请选择帐外库')
return;
}
if (this.itemNumber) {
this.$modal.showToast('该库位已绑定过备件')
return;
}
if (!this.form1.qty) {
this.$modal.showToast(`请输入数量`)
return;
}
if (this.form.itemNumbers && this.form.itemNumbers.length > 0) {
let arr = this.form.itemNumbers.filter(item => item.itemNumber == this.form1.itemNumber)
if (arr && arr.length > 0) {
this.$modal.showToast('该备件已添加')
return;
}
}
this.form.itemNumbers.push(this.form1)
this.isPopupShow = false
},
//
delSpareParts(index) {
this.form.itemNumbers.splice(index, 1)
},
getLocation() {
locationApi.getLocation(this.form1.locationNumber).then(res => {
if(!res.data){
this.$modal.showToast('找不到该库位')
return;
}
this.form1.areaNumber = res.data.areaNumber;
this.isInAccount = res.data.isInAccount || ''
this.itemNumber = res.data.itemNumber || ''
})
},
blur() {
if (this.form1.locationNumber) {
this.getLocation()
}
},
//
getSparePartsInfo() {
sparePartsApi.getSparePartsReturnInfo({
number: this.form1.itemNumber,
}).then(res => {
if(!res.data){
this.$modal.showToast('找不到该备件')
this.itemNumber = ''
this.form1.areaNumber = ''
this.form1.locationNumber = '';
this.isInAccount = ''
this.form1.itemName = ''
return;
}
this.itemNumber = ''
this.form1.areaNumber = res.data.areaNumber || ''
this.form1.locationNumber = res.data.locationNumber;
this.isInAccount = res.data.isInAccount|| ''
this.form1.itemName = res.data.itemName
if (!this.form1.locationNumber) {
this.isShow = true
}
})
},
blur1() {
if (this.form1.itemNumber) {
this.getSparePartsInfo()
}
},
},
async onLoad(option) {
this.getReverterUser()
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0rpx;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
top: 19px;
}
}
.list {
padding: 0rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 0rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

3
plugins/index.js

@ -1,6 +1,7 @@
import tab from './tab' import tab from './tab'
import auth from './auth' import auth from './auth'
import modal from './modal' import modal from './modal'
import time from './time'
export default { export default {
install(Vue) { install(Vue) {
@ -10,5 +11,7 @@ export default {
Vue.prototype.$auth = auth Vue.prototype.$auth = auth
// 模态框对象 // 模态框对象
Vue.prototype.$modal = modal Vue.prototype.$modal = modal
// 时间对象
Vue.prototype.$time = time
} }
} }

19
plugins/time.js

@ -0,0 +1,19 @@
export default {
formatDate(timestamp){
// 获取当前时间戳(单位:毫秒)
// var timestamp = Date.now(); // 或者传入特定的时间戳值
timestamp = timestamp ? timestamp :Date.now()
// 创建Date对象并设置时间戳
var dateObj = new Date(timestamp);
// 提取年份、月份、日期等信息
var year = dateObj.getFullYear();
var month = (dateObj.getMonth() + 1).toString().padStart(2, '0'); // 注意月份从0开始计数,所以需要加1
var day = dateObj.getDate().toString().padStart(2, '0');
var hour = dateObj.getHours().toString().padStart(2, '0');
var minutes = dateObj.getMinutes().toString().padStart(2, '0');
var seconds = dateObj.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minutes}:${seconds}`
}
}

BIN
static/images/icon1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
static/images/icon2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
static/images/icon3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

86
store/modules/user.js

@ -1,8 +1,16 @@
import config from '@/config' import config from '@/config'
import storage from '@/utils/storage' import storage from '@/utils/storage'
import constant from '@/utils/constant' import constant from '@/utils/constant'
import { login, logout, getInfo } from '@/api/login' import {
import { setToken, removeToken } from '@/utils/auth' login,
logout,
getInfo,
getPermissionInfo
} from '@/api/login'
import {
setToken,
removeToken
} from '@/utils/auth'
const baseUrl = config.baseUrl const baseUrl = config.baseUrl
@ -12,7 +20,10 @@ const user = {
name: storage.get(constant.name), name: storage.get(constant.name),
avatar: storage.get(constant.avatar), avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles), roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions) permissions: storage.get(constant.permissions),
role:storage.get(constant.role),
post:storage.get(constant.post),
dept:storage.get(constant.dept),
}, },
mutations: { mutations: {
@ -34,17 +45,36 @@ const user = {
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions
storage.set(constant.permissions, permissions) storage.set(constant.permissions, permissions)
},
SET_ROLE: (state, role) => {
state.role = role
storage.set(constant.role, role)
},
SET_DEPT: (state, dept) => {
state.dept = dept
storage.set(constant.dept, dept)
},
SET_POST: (state, post) => {
state.post = post
storage.set(constant.post, post)
} }
}, },
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({
commit
}, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim()
const password = userInfo.password const password = userInfo.password
const captchaVerification = userInfo.captchaVerification const captchaVerification = userInfo.captchaVerification
const tenantName = userInfo.tenantName
const rememberMe = userInfo.rememberMe
const code = userInfo.code
const uuid = userInfo.uuid
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, captchaVerification).then(res => { login(username, password, captchaVerification, tenantName, rememberMe, code, uuid).then(
res => {
res = res.data; res = res.data;
// 设置 token // 设置 token
setToken(res) setToken(res)
@ -55,19 +85,26 @@ const user = {
}) })
}, },
// 获取用户信息 // 获取权限
GetInfo({ commit, state }) { GetPermissionInfo({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getPermissionInfo().then(res => {
res = res.data; // 读取 data 数据 res = res.data; // 读取 data 数据
const user = res.user const user = res.user
const avatar = (user == null || user.avatar === "" || user.avatar == null) ? require("@/static/images/profile.jpg") : user.avatar const avatar = (user == null || user.avatar === "" || user.avatar == null) ?
const nickname = (user == null || user.nickname === "" || user.nickname == null) ? "" : user.nickname require("@/static/images/profile.jpg") : user.avatar
const nickname = (user == null || user.nickname === "" || user.nickname ==
null) ? "" : user.nickname
if (res.roles && res.roles.length > 0) { if (res.roles && res.roles.length > 0) {
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
commit('SET_ROLE', res.roles.filter(item => item == 'all_approve' || item == 'normal_approve')[0])
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.permissions)
} else { } else {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
commit('SET_ROLE','')
} }
commit('SET_NAME', nickname) commit('SET_NAME', nickname)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
@ -77,13 +114,38 @@ const user = {
}) })
}) })
}, },
// 获取权限
GetInfo({
commit,
state
}) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
res = res.data; // 读取 data 数据
commit('SET_DEPT', res.dept)
if (res.posts && res.posts.length > 0) {
commit('SET_POST', res.posts.filter(item => item.code == 'worker' || item.code == 'engineer')[0])
} else {
commit('SET_POST','')
}
resolve(res)
}).catch(error => {
reject(error)
})
})
},
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({
commit,
state
}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token).then(() => {
commit('SET_ROLES', []) commit('SET_ROLES', [])
commit('SET_PERMISSIONS', []) commit('SET_PERMISSIONS', [])
commit('SET_POST', '')
commit('SET_CLASSTYPE', '')
commit('SET_ROLE', '')
removeToken() removeToken()
storage.clean() storage.clean()
resolve() resolve()

6
utils/constant.js

@ -2,7 +2,9 @@ const constant = {
avatar: 'vuex_avatar', avatar: 'vuex_avatar',
name: 'vuex_name', name: 'vuex_name',
roles: 'vuex_roles', roles: 'vuex_roles',
permissions: 'vuex_permissions' permissions: 'vuex_permissions',
role: 'vuex_role',
dept: 'vuex_dept',
post: 'vuex_post',
} }
export default constant export default constant

2
utils/storage.js

@ -4,7 +4,7 @@ import constant from './constant'
let storageKey = 'storage_data' let storageKey = 'storage_data'
// 存储节点变量名 // 存储节点变量名
let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions] let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.role, constant.dept,constant.post]
// 存储的数据 // 存储的数据
let storageData = uni.getStorageSync(storageKey) || {} let storageData = uni.getStorageSync(storageKey) || {}

Loading…
Cancel
Save