Browse Source

添加权限和页面

master
lijuncheng 6 months ago
parent
commit
512d112b06
  1. 6
      src/App.vue
  2. 43
      src/api/request2.js
  3. 50
      src/common/classify.data.js
  4. 7
      src/common/utils/storage.js
  5. 45
      src/pages.json
  6. 186
      src/pages/foam/downLink.vue
  7. 302
      src/pages/foam/foamNoGood.vue
  8. 243
      src/pages/foam/upLink.vue
  9. 41
      src/pages/index/index.vue
  10. 302
      src/pages/plastics/plasticsNoGood.vue
  11. 275
      src/pages/plastics/scanCode.vue
  12. 1
      src/store/getters.js
  13. 22
      src/store/modules/user.js

6
src/App.vue

@ -7,18 +7,18 @@
export default {
onLaunch: function() {
console.log('App Launch')
// ,
// #ifdef APP-PLUS
// ,
uni.setStorageSync('hasLogin', false)
// ,
// plus.navigator.setFullscreen(true);
// // app
// plus.screen.lockOrientation('landscape-primary');
// // app
// plus.screen.lockOrientation('portrait-primary');
appUpdate(false);
// appUpdate(false);
// #endif
},

43
src/api/request2.js

@ -337,4 +337,47 @@ export function checkItemCodeByBucket(BucketCode,itemCode) {
});
}
/**
* @param params 泡沫合格品上悬链接 提交
*/
export function upLickSubmit(params) {
return request({
url: baseApi + "/Ware/Insert",
method: "post",
data: params,
});
}
/**
* @param params 泡沫合格品下悬链接 提交
*/
export function downLickSubmit(params) {
return request({
url: baseApi + "/Ware/Insert",
method: "post",
data: params,
});
}
/**
* @param params 泡沫不良品收货 提交
*/
export function foamNoGoodSubmit(params) {
return request({
url: baseApi + "/Ware/Insert",
method: "post",
data: params,
});
}
/**
* @param params 注塑不良品收货 提交
*/
export function plasticsNoGoodSubmit(params) {
return request({
url: baseApi + "/Ware/Insert",
method: "post",
data: params,
});
}

50
src/common/classify.data.js

@ -1,16 +1,45 @@
export default [{
"name": "泡沫",
"isShow":true,
"children": [{
"name": "泡沫点检",
"code":"PDA0000001",
"icon": "/count.svg",
"isShow":true,
"path": "/pages/foam/check",
"index": 1,
},
{
"name": "泡沫投料",
"code":"PDA0000002",
"icon": "/purchase_return.svg",
"isShow":true,
"path": "/pages/foam/input",
"index": 2,
},
{
"name": "合格品\n上悬链接",
"code":"PDA0000003",
"icon": "/purchase_return.svg",
"isShow":true,
"path": "/pages/foam/upLink",
"index": 2,
},
{
"name": "合格品\n下悬链接",
"code":"PDA0000004",
"icon": "/purchase_return.svg",
"isShow":true,
"path": "/pages/foam/downLink",
"index": 2,
},
{
"name": "不良品收货",
"code":"PDA0000005",
"icon": "/purchase_return.svg",
"isShow":true,
"path": "/pages/foam/foamNoGood",
"index": 2,
}
]
@ -18,18 +47,39 @@ export default [{
{
"name": "注塑",
"isShow":true,
"children": [{
"name": "注塑点检",
"code":"SPDA0000001",
"icon": "/query_supplier_deliver.svg",
"isShow":true,
"path": "/pages/plastics/check",
"index": 1,
},
{
"name": "注塑投料",
"code":"SPDA0000002",
"icon": "/unbind_pallet.svg",
"isShow":true,
"path": "/pages/plastics/input",
"index": 2,
},
{
"name": "开办件扫码",
"code":"SPDA0000003",
"icon": "/unbind_pallet.svg",
"isShow":true,
"path": "/pages/plastics/scanCode",
"index": 2,
},
{
"name": "不良品收货",
"code":"SPDA0000004",
"icon": "/unbind_pallet.svg",
"isShow":true,
"path": "/pages/plastics/plasticsNoGood",
"index": 2,
},
]
}

7
src/common/utils/storage.js

@ -1,10 +1,16 @@
// 获取本地存储对应key
const getStorage = (key)=>{
if(key==undefined){
return ""
}
return uni.getStorageSync( key );
}
// 设置本地存储对应key
const setStorage = (key,value)=>{
if(key==undefined){
return ""
}
return uni.setStorageSync( key,value );
}
@ -24,6 +30,7 @@ const constant = {
avatar: 'avatar',
name: 'name',
roles: 'roles',
powers:"powers",
permissions: 'permissions'
}

45
src/pages.json

@ -46,6 +46,33 @@
"enablePullDownRefresh" : false
}
},
{
"path": "pages/foam/upLink",
"style": {
"navigationBarTitleText": "合格品上悬链接",
"titleNView": {
"buttons": [{}]
}
}
},
{
"path": "pages/foam/downLink",
"style": {
"navigationBarTitleText": "合格品下悬链接",
"titleNView": {
"buttons": [{}]
}
}
},
{
"path": "pages/foam/foamNoGood",
"style": {
"navigationBarTitleText": "不良品收货",
"titleNView": {
"buttons": [{}]
}
}
},
{
"path": "pages/plastics/check",
"style": {
@ -64,6 +91,24 @@
}
}
},
{
"path": "pages/plastics/plasticsNoGood",
"style": {
"navigationBarTitleText": "不良品收货",
"titleNView": {
"buttons": [{}]
}
}
},
{
"path": "pages/plastics/scanCode",
"style": {
"navigationBarTitleText": "开办件扫码",
"titleNView": {
"buttons": [{}]
}
}
},
{
"path": "pages/common/plan",
"style": {

186
src/pages/foam/downLink.vue

@ -0,0 +1,186 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;width: 100%;">
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="扫描" subTitle="扫码" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 90%; ">
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="scanCode" @clear="clearCode"
@confirm="onConfirm"></uni-easyinput>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> -->
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
</view>
</template>
<script module="render" lang="renderjs">
export default {
methods: {
_inputFocus(event) {
document.querySelector('#inputSelect input').select()
}
}
}
</script>
<script>
import {
downLickSubmit
} from '@/api/request2.js';
import {
showConfirmMsg
} from "@/common/utils.js"
import {
getCurrDateTime,
} from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue"
export default {
components: {
selectClickList
},
data() {
return {
dateTime: "",
dataList: [],
userForm: {
names: [],
values: [],
origin: []
},
materialList: [],
planList: [],
scanCode: ""
}
},
computed: {},
onLoad() {},
onUnload() {},
onReady() {
},
methods: {
submit() {
uni.showLoading({
title: "加载中",
mask: true
})
var param = {
id: this.$store.state.user.id,
createTime: getCurrDateTime(),
}
console.log("提交", JSON.stringify(param))
downLickSubmit(param).then(res => {
uni.hideLoading()
this.showMessage("提交成功")
this.resetData()
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(hint) {
showConfirmMsg("提示", hint, false, callBack => {
})
},
resetData() {
},
clearCode() {
this.scanCode = "";
},
onConfirm(data) {
console.log(data)
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.input {
padding: 10rpx;
height: 65rpx;
text-align: left;
margin: 5rpx;
font-size: 28rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
outline: none;
border-radius: 10rpx;
border: 1rpx solid lightgrey;
}
</style>

302
src/pages/foam/foamNoGood.vue

@ -0,0 +1,302 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;width: 100%;">
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="计划单号" subTitle="选择计划单号" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 75%; ">
<uni-easyinput disabled style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="planNumber"></uni-easyinput>
</view>
<view class="uni-flex" style="width: 25%; align-items: center;">
<button type="primary" size="mini" @click="showPlanSelect">单号</button>
</view>
</view>
</view>
<view class="">
<uni-section title="选择原因" subTitle="" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between" @click="showReasonPicker" style="height: 70rpx; align-items: center;
margin: 10rpx;
background-color: #F7F6F6; border: 1rpx solid #E5E5E5; border-radius: 10rpx; font-size: 38rpx;">
<view class="" style="margin-left: 20rpx;">
{{reason}}
</view>
<view class="">
<uni-icons type="forward" size="28"></uni-icons>
</view>
</view>
<u-picker mode="selector" v-model="showReason" :range="reasonRange"
@confirm="confirmReason"></u-picker>
</view>
<view class="">
<uni-section title="选择类型" subTitle="" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between" @click="showTypePicker" style="height: 70rpx; align-items: center;
margin: 10rpx;
background-color: #F7F6F6; border: 1rpx solid #E5E5E5; border-radius: 10rpx; font-size: 38rpx;">
<view class="" style="margin-left: 20rpx; align-items: center;">
{{type}}
</view>
<view class="">
<uni-icons type="forward" size="28"></uni-icons>
</view>
</view>
<u-picker mode="selector" v-model="showType" :range="typeRange"
@confirm="confirmType"></u-picker>
</view>
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="扫描" subTitle="扫码" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 90%; ">
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="scanCode" @clear="clearCode" @confirm="onConfirm"></uni-easyinput>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> -->
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
<selectClickList ref="selectPopup" title="选择计划单号" @select="selectPlan"></selectClickList>
</view>
</template>
<script module="render" lang="renderjs">
export default {
methods: {
_inputFocus(event) {
document.querySelector('#inputSelect input').select()
}
}
}
</script>
<script>
import {
getFoamPlaneNumberList,
foamNoGoodSubmit
} from '@/api/request2.js';
import {
showConfirmMsg
} from "@/common/utils.js"
import {
getCurrDateTime,
} from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue"
export default {
components: {
selectClickList
},
data() {
return {
dateTime: "",
planNumber: "",
dataList: [],
userForm: {
names: [],
values: [],
origin: []
},
materialList: [],
planList: [],
scanCode: "",
showReason: false,
showType: false,
reason: "",
type: "",
mode: 'selector',
reasonRange: ['破损', '返工与返修'],
typeRange: ["合格", "报废"]
}
},
computed: {},
onLoad() {},
onUnload() {},
onReady() {
},
methods: {
showTypePicker() {
this.showType = true;
},
confirmType(e) {
this.type = this.typeRange[e[0]];
console.log("原因", JSON.stringify(e))
},
showReasonPicker() {
this.showReason = true;
},
confirmReason(e) {
this.reason = this.reasonRange[e[0]];
console.log("原因", JSON.stringify(e))
},
submit() {
if (this.planNumber == "") {
this.showMessage("请选择计划单号")
return
}
uni.showLoading({
title: "加载中",
mask: true
})
var param = {
planNumber: this.planNumber,
id: this.$store.state.user.id,
createTime: getCurrDateTime(),
}
console.log("提交", JSON.stringify(param))
foamNoGoodSubmit(param).then(res => {
uni.hideLoading()
this.showMessage("提交成功")
this.resetData()
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(hint) {
showConfirmMsg("提示", hint, false, callBack => {
})
},
resetData() {
this.planNumber = "";
},
clearCode() {
this.scanCode = "";
},
onConfirm(data) {
console.log(data)
},
showPlanSelect() {
uni.showLoading({
title: "加载中",
mask: true
})
getFoamPlaneNumberList().then(res => {
uni.hideLoading()
if (res.Result.length > 0) {
var list = [];
list = res.Result;
list.forEach(res => {
res.label = res.PLAN_NO;
res.value = res.SHIFT_CODE
})
this.$refs.selectPopup.openScanPopup(list)
} else {
this.showMessage("原料列表为0")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
selectPlan(data) {
this.planNumber = data.label
console.log(data)
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.input {
padding: 10rpx;
height: 65rpx;
text-align: left;
margin: 5rpx;
font-size: 28rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
outline: none;
border-radius: 10rpx;
border: 1rpx solid lightgrey;
}
</style>

243
src/pages/foam/upLink.vue

@ -0,0 +1,243 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;width: 100%;">
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="计划单号" subTitle="选择计划单号" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 75%; ">
<uni-easyinput disabled style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="planNumber"></uni-easyinput>
</view>
<view class="uni-flex" style="width: 25%; align-items: center;">
<button type="primary" size="mini" @click="showPlanSelect">单号</button>
</view>
</view>
</view>
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="扫描" subTitle="扫码" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 75%; ">
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="scanCode" @clear="clearCode"
@confirm="onConfirm"></uni-easyinput>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> -->
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
<selectClickList ref="selectPopup" title="选择计划单号" @select="selectPlan"></selectClickList>
</view>
</template>
<script module="render" lang="renderjs">
export default {
methods: {
_inputFocus(event) {
document.querySelector('#inputSelect input').select()
}
}
}
</script>
<script>
import {
getFoamPlaneNumberList,
upLickSubmit
} from '@/api/request2.js';
import {
showConfirmMsg
} from "@/common/utils.js"
import {
getCurrDateTime,
} from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue"
export default {
components: {
selectClickList
},
data() {
return {
dateTime: "",
planNumber: "",
dataList: [],
userForm: {
names: [],
values: [],
origin: []
},
materialList: [],
planList: [],
scanCode: ""
}
},
computed: {},
onLoad() {},
onUnload() {},
onReady() {
},
methods: {
submit() {
if (this.planNumber == "") {
this.showMessage("请选择计划单号")
return
}
uni.showLoading({
title: "加载中",
mask: true
})
var param = {
planNumber: this.planNumber,
id: this.$store.state.user.id,
createTime: getCurrDateTime(),
}
console.log("提交", JSON.stringify(param))
upLickSubmit(param).then(res => {
uni.hideLoading()
this.showMessage("提交成功")
this.resetData()
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(hint) {
showConfirmMsg("提示", hint, false, callBack => {
})
},
resetData() {
this.planNumber = "";
this.materialName = ""
this.materialQty = "";
this.materialCode = ""
},
clearCode() {
this.scanCode = "";
},
onConfirm(data) {
console.log(data)
},
showPlanSelect() {
uni.showLoading({
title: "加载中",
mask: true
})
getFoamPlaneNumberList().then(res => {
uni.hideLoading()
if (res.Result.length > 0) {
var list = [];
list = res.Result;
list.forEach(res => {
res.label = res.PLAN_NO;
res.value = res.SHIFT_CODE
})
this.$refs.selectPopup.openScanPopup(list)
} else {
this.showMessage("原料列表为0")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
selectPlan(data) {
this.planNumber = data.label
console.log(data)
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.input {
padding: 10rpx;
height: 65rpx;
text-align: left;
margin: 5rpx;
font-size: 28rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
outline: none;
border-radius: 10rpx;
border: 1rpx solid lightgrey;
}
</style>

41
src/pages/index/index.vue

@ -29,6 +29,7 @@
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
:scroll-into-view="itemId">
<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
<text class="u-line-1">{{item.name}}</text>
</view>
@ -96,8 +97,10 @@
}
},
onLoad() {
var test =""
if (uni.getStorageSync("hasLogin")) {
this.tabbar = classifyData;
this.tabbar = this.getPowersByRoles();
} else {
this.tabbar = []
}
@ -148,6 +151,38 @@
},
mounted() {},
methods: {
getPowersByRoles(){
var permissionList = this.$store.state.user.powers
var tempList=[];
classifyData.forEach(menuItem=>{
var temp = {
name :menuItem.name,
isShow:menuItem.isShow,
children:[]
}
menuItem.children.forEach(rightItem=>{
permissionList.forEach(permission=>{
if(rightItem.code==permission){
rightItem.isShow=true
temp.children.push(rightItem)
}else {
rightItem.isShow=false
}
})
})
tempList.push(temp)
})
var showList =[];
tempList.forEach(res=>{
if(res.children.length>0){
showList.push(res)
}
})
return showList;
},
findList(tab) {
let res = null
for (let i = 0; i < tab.length; i++) {
@ -270,8 +305,10 @@
uni.navigateTo({
url: url
});
this.filterList = []
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {

302
src/pages/plastics/plasticsNoGood.vue

@ -0,0 +1,302 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;width: 100%;">
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="计划单号" subTitle="选择计划单号" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 75%; ">
<uni-easyinput disabled style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="planNumber"></uni-easyinput>
</view>
<view class="uni-flex" style="width: 25%; align-items: center;">
<button type="primary" size="mini" @click="showPlanSelect">单号</button>
</view>
</view>
</view>
<view class="">
<uni-section title="选择原因" subTitle="" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between" @click="showReasonPicker" style="height: 70rpx; align-items: center;
margin: 10rpx;
background-color: #F7F6F6; border: 1rpx solid #E5E5E5; border-radius: 10rpx; font-size: 38rpx;">
<view class="" style="margin-left: 20rpx;">
{{reason}}
</view>
<view class="">
<uni-icons type="forward" size="28"></uni-icons>
</view>
</view>
<u-picker mode="selector" v-model="showReason" :range="reasonRange"
@confirm="confirmReason"></u-picker>
</view>
<view class="">
<uni-section title="选择类型" subTitle="" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between" @click="showTypePicker" style="height: 70rpx; align-items: center;
margin: 10rpx;
background-color: #F7F6F6; border: 1rpx solid #E5E5E5; border-radius: 10rpx; font-size: 38rpx;">
<view class="" style="margin-left: 20rpx; align-items: center;">
{{type}}
</view>
<view class="">
<uni-icons type="forward" size="28"></uni-icons>
</view>
</view>
<u-picker mode="selector" v-model="showType" :range="typeRange"
@confirm="confirmType"></u-picker>
</view>
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="扫描" subTitle="扫码" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 90%; ">
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="scanCode" @clear="clearCode" @confirm="onConfirm"></uni-easyinput>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> -->
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
<selectClickList ref="selectPopup" title="选择计划单号" @select="selectPlan"></selectClickList>
</view>
</template>
<script module="render" lang="renderjs">
export default {
methods: {
_inputFocus(event) {
document.querySelector('#inputSelect input').select()
}
}
}
</script>
<script>
import {
getFoamPlaneNumberList,
foamNoGoodSubmit
} from '@/api/request2.js';
import {
showConfirmMsg
} from "@/common/utils.js"
import {
getCurrDateTime,
} from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue"
export default {
components: {
selectClickList
},
data() {
return {
dateTime: "",
planNumber: "",
dataList: [],
userForm: {
names: [],
values: [],
origin: []
},
materialList: [],
planList: [],
scanCode: "",
showReason: false,
showType: false,
reason: "",
type: "",
mode: 'selector',
reasonRange: ['破损', '返工与返修'],
typeRange: ["合格", "报废"]
}
},
computed: {},
onLoad() {},
onUnload() {},
onReady() {
},
methods: {
showTypePicker() {
this.showType = true;
},
confirmType(e) {
this.type = this.typeRange[e[0]];
console.log("原因", JSON.stringify(e))
},
showReasonPicker() {
this.showReason = true;
},
confirmReason(e) {
this.reason = this.reasonRange[e[0]];
console.log("原因", JSON.stringify(e))
},
submit() {
if (this.planNumber == "") {
this.showMessage("请选择计划单号")
return
}
uni.showLoading({
title: "加载中",
mask: true
})
var param = {
planNumber: this.planNumber,
id: this.$store.state.user.id,
createTime: getCurrDateTime(),
}
console.log("提交", JSON.stringify(param))
foamNoGoodSubmit(param).then(res => {
uni.hideLoading()
this.showMessage("提交成功")
this.resetData()
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(hint) {
showConfirmMsg("提示", hint, false, callBack => {
})
},
resetData() {
this.planNumber = "";
},
clearCode() {
this.scanCode = "";
},
onConfirm(data) {
console.log(data)
},
showPlanSelect() {
uni.showLoading({
title: "加载中",
mask: true
})
getFoamPlaneNumberList().then(res => {
uni.hideLoading()
if (res.Result.length > 0) {
var list = [];
list = res.Result;
list.forEach(res => {
res.label = res.PLAN_NO;
res.value = res.SHIFT_CODE
})
this.$refs.selectPopup.openScanPopup(list)
} else {
this.showMessage("原料列表为0")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
selectPlan(data) {
this.planNumber = data.label
console.log(data)
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.input {
padding: 10rpx;
height: 65rpx;
text-align: left;
margin: 5rpx;
font-size: 28rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
outline: none;
border-radius: 10rpx;
border: 1rpx solid lightgrey;
}
</style>

275
src/pages/plastics/scanCode.vue

@ -0,0 +1,275 @@
<template>
<view class="page-wraper">
<view class="page-header flex"
style="font-size: 32rpx; padding-left: 10rpx; padding-top: 10rpx; flex-direction: column;">
</view>
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
<view style="padding-bottom: 80rpx;width: 100%;">
<view class="uni-flex uni-column " style="margin: 10rpx;">
<uni-section title="扫描" subTitle="扫码" subTitleFontSize="26rpx" titleFontSize="35rpx"
type="line">
</uni-section>
<view class="uni-flex space-between">
<view class="" style="width: 75%; ">
<uni-easyinput style="margin-left: 10rpx; margin-right: 10rpx;" trim="all"
v-model="scanCode" @clear="clearCode"
@confirm="onConfirm"></uni-easyinput>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="page-footer">
<view class="uni-flex u-col-center space-between padding_10"
style="background-color:ghostwhite; width: 100%; ">
<view class="">
<!-- <button class="btn_single_reset" hover-class="btn_single_after" @click="reset">重置</button> -->
</view>
<view class=" uni-flex uni-row">
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
<selectClickList ref="selectPopup" title="选择计划单号" @select="selectPlan"></selectClickList>
<selectClickList ref="selectPopupMaterial" title="选择原料" @select="selectMaterial"></selectClickList>
</view>
</template>
<script module="render" lang="renderjs">
export default {
methods: {
_inputFocus(event) {
document.querySelector('#inputSelect input').select()
}
}
}
</script>
<script>
import {
getFoamPlaneNumberList,
getMaterialLists,
foamInputSubmit
} from '@/api/request2.js';
import {
showConfirmMsg
} from "@/common/utils.js"
import {
getCurrDateTime,
} from "@/common/basic.js"
import selectClickList from "@/mycomponents/popup/selectClickList.vue"
export default {
components: {
selectClickList
},
data() {
return {
dateTime: "",
planNumber: "",
materialName: "",
materialCode: "",
materialQty: "",
dataList: [],
userForm: {
names: [],
values: [],
origin: []
},
materialList: [],
planList: [],
scanCode: ""
}
},
computed: {},
onLoad() {},
onUnload() {},
onReady() {
},
methods: {
submit() {
if (this.planNumber == "") {
this.showMessage("请选择计划单号")
return
}
if (this.materialName == "") {
this.showMessage("请输入原料名称")
return
}
if (this.materialQty == "" || this.materialQty == 0) {
this.showMessage("请输入原料数量")
return
}
uni.showLoading({
title: "加载中",
mask: true
})
var param = {
planNumber: this.planNumber,
materialName: this.materialName,
materialCode: this.materialCode,
materialQty: this.materialQty,
id: this.$store.state.user.id,
createTime: getCurrDateTime(),
}
console.log("提交", JSON.stringify(param))
foamInputSubmit(param).then(res => {
uni.hideLoading()
this.showMessage("提交成功")
this.resetData()
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
showMessage(hint) {
showConfirmMsg("提示", hint, false, callBack => {
})
},
resetData() {
this.planNumber = "";
this.materialName = ""
this.materialQty = "";
this.materialCode = ""
},
clearCode() {
this.scanCode = "";
},
onConfirm(data) {
console.log(data)
},
showPlanSelect() {
uni.showLoading({
title: "加载中",
mask: true
})
getFoamPlaneNumberList().then(res => {
uni.hideLoading()
if (res.Result.length > 0) {
var list = [];
list = res.Result;
list.forEach(res => {
res.label = res.PLAN_NO;
res.value = res.SHIFT_CODE
})
this.$refs.selectPopup.openScanPopup(list)
} else {
this.showMessage("原料列表为0")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
selectPlan(data) {
this.planNumber = data.label
console.log(data)
},
showMaterialSelect() {
uni.showLoading({
title: "加载中",
mask: true
})
getMaterialLists().then(res => {
uni.hideLoading()
if (res.Result.length > 0) {
var list = [];
list = res.Result;
list.forEach(res => {
res.label = res.Name;
res.value = res.Code
})
this.$refs.selectPopupMaterial.openScanPopup(list)
} else {
this.showMessage("原料列表为0")
}
}).catch(error => {
uni.hideLoading()
this.showMessage(error)
})
},
selectMaterial(data) {
this.materialName = data.label
this.materialCode = data.value
this.$refs.inputQty.focused = true
console.log("selectPopupMaterial")
},
openScanPopup() {
this.$refs.scanPopup.openScanPopup();
},
closeScanPopup() {
this.$refs.scanPopup.closeScanPopup();
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.input {
padding: 10rpx;
height: 65rpx;
text-align: left;
margin: 5rpx;
font-size: 28rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
outline: none;
border-radius: 10rpx;
border: 1rpx solid lightgrey;
}
</style>

1
src/store/getters.js

@ -4,6 +4,7 @@ const getters = {
avatar: state => state.user.avatar,
name: state => state.user.name,
roles: state => state.user.roles,
powers: state => state.user.powers,
permissions: state => state.user.permissions,
hasLogin:state=>state.user.hasLogin
}

22
src/store/modules/user.js

@ -14,7 +14,8 @@ const user = {
name: storage.getStorage(storage.constant.name),
avatar: storage.getStorage(storage.constant.avatar),
roles: storage.getStorage(storage.constant.roles),
permissions: storage.getStorage(storage.constant.permissions)
permissions: storage.getStorage(storage.constant.permissions),
powers:storage.getStorage(storage.constant.powers)
},
mutations: {
@ -38,6 +39,12 @@ const user = {
state.permissions = permissions
storage.setStorage(storage.constant.permissions, permissions)
},
SET_POWERS: (state, powers) => {
state.powers = powers
storage.setStorage(storage.constant.powers, powers)
}
},
@ -52,8 +59,21 @@ const user = {
return new Promise((resolve, reject) => {
login(username, password).then(res => {
if(res){
res.Result.Powers =[
"PDA0000001",
"PDA0000002",
"PDA0000003",
"PDA0000004",
"PDA0000005",
"SPDA0000001",
"SPDA0000002",
"SPDA0000003",
"SPDA0000004"
]
commit('SET_ID',res.Result.LoginUserID)
commit('SET_NAME',res.Result.UserName)
commit('SET_POWERS',res.Result.Powers)
resolve(res)
}else {
uni.showToast({

Loading…
Cancel
Save