定点作业、出库确认、作业管理

This commit is contained in:
2024-03-13 15:42:17 +08:00
parent 6fdce408c4
commit f895730977
13 changed files with 864 additions and 263 deletions

View File

@@ -33,6 +33,15 @@ uni-button:after {
margin-bottom: 20rpx;
box-shadow: 0 4rpx 10rpx 2rpx rgba(0,0,0,.1);
}
.filter_wrapper {
position relative
left -14rpx
width: calc(100% + 28rpx);
height: auto;
background-color: #fff;
padding: 22rpx 22rpx 0 22rpx;
margin-bottom: 20rpx;
}
.filter_label {
display: block;
line-height: 80rpx;
@@ -73,23 +82,6 @@ uni-button:after {
.filter_input_disabled {
background-color: #eee;
}
.filter_search {
width: 100rpx;
height: 70rpx;
line-height: 70rpx;
font-size: 28rpx;
color: #323232;
text-align: center;
background-color: #fff;
border: 1px solid #ff6a00;
border-radius: 10rpx;
margin-left: 30rpx;
}
.filter_search_disabled {
background-color: #dcdfe6;
border: 1px solid #dcdfe6;
color: #fff;
}
.filter_input_wraper {
/* flex: 1; */
width: calc(100% - 170rpx);
@@ -100,6 +92,21 @@ uni-button:after {
justify-content: flex-start;
align-items: center;
}
.tab-line {
_wh(32rpx, 10rpx)
background-color #fff
border-radius 10rpx
margin 20rpx auto 0
}
.tab-line_active {
background-color #4e6ef2
}
.font-style-1 {
_font(32rpx, 32rpx, #c1c1c3,,center)
}
.font-style-2 {
_font(32rpx, 32rpx, #000,bold,center)
}
.grid-wraper {
width: 100%;
}
@@ -224,72 +231,34 @@ uni-button:after {
margin-bottom: 20rpx;
box-shadow: 0 4rpx 10rpx 2rpx rgba(0,0,0,.1);
}
.item-font-1 {
font-size: 28rpx;
color: #42444a;
line-height: 30rpx;
padding: 14rpx 4rpx;
}
.item-font-2 {
font-size: 26rpx;
color: #2b87ff;
line-height: 30rpx;
padding: 14rpx 4rpx;
background-color: #edf6ff;
border-radius: 10rpx;
text-align: center;
}
.item-font-3 {
font-size: 26rpx;
color: #ff8824;
line-height: 30rpx;
padding: 14rpx 4rpx;
background-color: #fff4ea;
border-radius: 10rpx;
text-align: center;
}
.item-font-4 {
font-size: 26rpx;
color: #c1c1c3;
line-height: 30rpx;
padding: 14rpx 4rpx;
}
.item-status {
font-size: 26rpx;
color: #fff;
line-height: 30rpx;
padding: 6rpx 1rpx;
background-color: #fff;
border-radius: 10rpx;
text-align: center;
}
.item-status-1 {
background-color: #cfd2d4;
color: #5e5d5d;
}
.item-status-2 {
color: #bf8836;
background-color: #f0e2cd;
}
.item-status-3 {
background-color: #f3ccb5;
color: #ff5e00;
}
.item-status-4 {
background-color: #96f3b8;
color: #36744c;
}
.item-line-1 {
height: 1rpx;
background-color: #b8b8ba;
}
.item-line-2 {
width: 1rpx;
height: 30rpx;
background-color: #000;
margin: 0 14rpx;
}
.item-font-1
_font(30rpx,28rpx,#000,,)
.item-font-2
_font(24rpx,40rpx,$red,,)
.item-font-3
width 110rpx
_font(24rpx,26rpx,#333,,)
text-align:justify;
text-align-last: justify;
text-justify: inter-ideograph;
.item-font-4
width calc(100% - 110rpx)
_font(26rpx,26rpx,#999,,)
.item-font-5
_font(44rpx,60rpx,$green,,center)
background-color #f6f6f6
.item-font-6
width calc(50% - 110rpx)
_font(24rpx,52rpx,#666,,center)
background-color #e5e5e5
border-radius 26rpx
.item-font-7
width 110rpx
_font(24rpx,52rpx,#666,,center)
.item-font-8
_font(24rpx,52rpx,#666,,center)
.isChecked
box-shadow inset 2px 2px 4px 0px rgba(120, 141, 250, 0.7), inset -2px -2px 4px 0px rgba(120, 141, 250, 0.7)
/** **/
.submit-bar {
position: fixed;
@@ -328,6 +297,9 @@ uni-button:after {
border: 2rpx solid #c9c9c9;
color: #fff;
}
uni-button[disabled]:not([type]), uni-button[disabled][type=default] {
border: 2rpx solid #c9c9c9;
}
.submit-more {
width: 20%;
font-size: 34rpx;

View File

@@ -53,6 +53,9 @@ input[type="button"], input[type="submit"], input[type="search"], input[type="re
.jcflexend {
justify-content: flex-end !important;
}
.jccenter {
justify-content: center !important;
}
.zd-row {
width: 100%;
@@ -146,4 +149,7 @@ input[type="button"], input[type="submit"], input[type="search"], input[type="re
}
.pdr10 {
padding-right: 10rpx;
}
.pdt0 {
padding-top: 0 !important
}

View File

@@ -4,9 +4,9 @@
<uni-icons @tap="goBack" type="back" size="26" color="#fff"></uni-icons>
</view>
<view class="zd-col-16 page_name">{{title}}</view>
<!-- <view class="zd-col-4" style="text-align: right">
<uni-icons @tap="backHome" type="home-filled" size="26" color="#fff" :class="{'vhide': show1 === false}"></uni-icons>
</view> -->
<view v-if="searchActive" class="zd-col-4" style="text-align: right">
<uni-icons @tap="toSearch" type="search" size="26" color="#fff"></uni-icons>
</view>
</view>
</template>
@@ -26,9 +26,9 @@
type: Boolean,
default: false
},
show1: {
searchActive: {
type: Boolean,
default: true
default: false
}
},
methods: {
@@ -43,10 +43,8 @@
})
}
},
backHome () {
uni.redirectTo({
url: '/pages/home/home'
})
toSearch () {
this.$emit('toSearch')
}
}
}

View File

@@ -66,6 +66,30 @@
}
}
,{
"path" : "pages/manage/fixed-point-task",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/manage/task-manage",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/manage/out-storage-confirm",
"style" :
{
"navigationStyle": "custom"
}
}
],
"globalStyle": {
// "pageOrientation": "landscape",

View File

@@ -50,9 +50,9 @@
{id: 4, title: '原料出库', icon: 'RF04', path: '/pages/manage/mater-out-storage'},
{id: 5, title: '生产下料', icon: 'RF05', path: '/pages/manage/produce-cut'},
{id: 6, title: '点位更新', icon: 'RF06', path: '/pages/manage/point-update'},
{id: 7, title: '定点作业', icon: 'RF07', path: ''},
{id: 8, title: '作业管理', icon: 'RF08', path: ''},
{id: 9, title: '出库确认', icon: 'RF09', path: ''}
{id: 7, title: '定点作业', icon: 'RF07', path: '/pages/manage/fixed-point-task'},
{id: 8, title: '作业管理', icon: 'RF08', path: '/pages/manage/task-manage'},
{id: 9, title: '出库确认', icon: 'RF09', path: '/pages/manage/out-storage-confirm'}
],
show: false,
secM: []

View File

@@ -1,6 +1,6 @@
<template>
<view class="zd_container">
<nav-bar title="设置" :inner2="true" @goIn="goIn" :show1="false"></nav-bar>
<nav-bar title="设置" :inner2="true" @goIn="goIn"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="setup-item">

View File

@@ -0,0 +1,146 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起点区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index1" filterable :localdata="options1" @change="selectChange1"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起点点位</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index2" filterable :localdata="options2"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">终点区域</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index3" filterable :localdata="options3" @change="selectChange3"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">终点点位</span>
</view>
<view class="zd-col-19 filter_select">
<zxz-uni-data-select v-model="index4" filterable :localdata="options4"></zxz-uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-default" @tap="clearUp">清空</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !index2 || !index4}" :disabled="disabled" @tap="_taskConfirm">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryDevice, taskConfirm} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options1: [],
index1: '',
options2: [],
index2: '',
options3: [],
index3: '',
options4: [],
index4: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryDevice()
},
methods: {
/** 点位下拉框 */
async _queryDevice () {
let res = await queryDevice()
res.map(el => {
this.$set(el, 'value', el.region_code)
this.$set(el, 'text', el.region_name)
})
this.options1 = [...res]
this.options3 = [...res]
},
selectChange1 (e) {
this.options2 = []
this.options1.map(el => {
if (el.value === e) {
this.options2 = [...el.deviceArr]
}
})
if (this.options2.length > 0) {
this.options2.map(ele => {
this.$set(ele, 'value', ele.point_code)
this.$set(ele, 'text', ele.point_name)
})
}
},
selectChange3 (e) {
this.options4 = []
this.options3.map(el => {
if (el.value === e) {
this.options4 = [...el.deviceArr]
}
})
if (this.options4.length > 0) {
this.options4.map(ele => {
this.$set(ele, 'value', ele.point_code)
this.$set(ele, 'text', ele.point_name)
})
}
},
async _taskConfirm () {
this.disabled = true
if (!this.index2 || this.index4 === '') {
this.disabled = false
return
}
try {
let res = await taskConfirm(this.index2, this.index4)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.index1 = ''
this.index2 = ''
this.index3 = ''
this.index4 = ''
this.options2 = []
this.options4 = []
this.disabled = false
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,174 @@
<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">出库点位</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_code" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料名称</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_name" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">配盘批次</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.pcsn" disabled>
</view>
</view>
<view class="zd-row border-bottom filter_input_disabled">
<view class="zd-col-5">
<span class="filter_label">物料数量</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="data.material_qty" disabled>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">出库数量</span>
</view>
<view class="zd-col-19">
<input type="number" class="filter_input" v-model="val3">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">剩余数量</span>
</view>
<view class="zd-col-19">
<input type="number" class="filter_input" v-model="val4">
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap="clearUp">清空</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !val2 ||!val4}" :disabled="disabled1" @tap="_emptyInStore">出库确认</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !val1 || !val2 ||!val4}" :disabled="disabled2" @tap="_emptyInStore">回库</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryGroupInfoByVehicle, fullVehicleOutConfirm, vehicleGoBack} from '@/utils/getData2.js'
import {accSubtract} from '@/utils/utils.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
val1: '',
val2: '',
val3: '',
data: {},
title: '',
disabled1: false,
disabled2: false
};
},
computed: {
val4 () {
let res = ''
if (JSON.stringify(this.data) !== '{}') {
res = accSubtract(this.data.material_qty, this.val3)
}
return res
}
},
onLoad (options) {
this.title = options.title
},
methods: {
handleChange (e) {
this._queryGroupInfoByVehicle(e)
},
async _queryGroupInfoByVehicle (e) {
let res = await queryGroupInfoByVehicle(e)
this.data = res
this.val2 = this.data.point_code
},
async _fullVehicleOutConfirm () {
this.disabled1 = true
if (!this.val1 || !this.val2 || !this.val4) {
this.disabled1 = false
return
}
try {
let res = await fullVehicleOutConfirm(this.val2, this.val1, this.val4)
this.disabled1 = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled1 = false
}
},
async _vehicleGoBack () {
this.disabled2 = true
if (!this.val1 || !this.val2 || !this.val4) {
this.disabled2 = false
return
}
try {
let res = await vehicleGoBack(this.val2, this.val1, this.val4)
this.disabled2 = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled2 = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.data = {}
this.disabled1 = false
this.disabled2 = false
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -0,0 +1,185 @@
<template>
<view class="zd_container">
<nav-bar :title="title" :searchActive="true" @toSearch="toSearch"></nav-bar>
<view class="zd_content pdt0">
<view class="filter_wrapper">
<view class="zd-row">
<view class="zd-col-8 font-style-1" v-for="e in state" :key="e.id" @tap="changeTab(e)">
<view class="font-style-1" :class="{'font-style-2': e.id === tab}">{{e.text}}</view>
<view class="tab-line" :class="{'tab-line_active': e.id === tab}"></view>
</view>
</view>
</view>
<view class="item-wrapper">
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.inst_uuid}">
<view class="zd-row mgb10">
<view class="item-font-1">{{e.task_no}}&nbsp;&#124;&nbsp;{{['就绪', '执行中', '完成'][Number(e.inst_status)]}}</view>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="item-font-2 mgb10">{{e.create_time}}&nbsp;&#124;&nbsp;{{['请求取货', '取货完成', '请求放货', '放货完成'][Number(e.inst_step) - 1]}}</view>
<view class="zd-row mgb10">
<view class="item-font-3">载具号</view>
<view class="item-font-4">{{e.carrier}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">指令号</view>
<view class="item-font-4">{{e.instruction_code}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">车号</view>
<view class="item-font-4">{{e.carno}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-8">优先级</view>
</view>
</view>
<view class="zd-row">
<view class="item-font-3">设备</view>
<view class="item-font-6">{{e.start_devicecode}}</view>
<view class="item-font-7">&ndash;</view>
<view class="item-font-6">{{e.next_devicecode}}</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('1')">指令撤销</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('2')">重新下发</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('3')">强制完成</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起始设备</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">目标设备</span>
</view>
<view class="zd-col-19 filter_select">
<search-box
v-model="val3"
/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap.stop="show = false">取消</button>
<button class="zd-col-7 button-default" @tap.stop="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="_pdaInsts">查询</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {pdaInsts, pdaInst} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
show: false,
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}, {id:'2', text: '完成'}],
tab: '-1',
title: '',
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._pdaInsts()
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
async _pdaInsts () {
this.show = false
let res = await pdaInsts(this.val1, this.val2, this.val3)
if (res.code === '1') {
this.data = [...res.result]
this.dataList = [...this.data]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
let arr = this.data.filter(el => {return el.inst_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _pdaInst (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await pdaInst(type, this.pkId)
this.disabled = false
this.tab = '-1'
this._pdaInsts()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.pkId = ''
this.disabled = false
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -1,16 +0,0 @@
import request from './request.js'
// 登录
export const handLogin = (user, password) => request({
url:'mobile/auth/login',
data: {
username: user,
password: password
}
})
// 测试状态码报错接口
export const handRequest = () => request({
url:'getInfo/4',
data: {}
})

View File

@@ -1,5 +1,4 @@
import request from './request.js'
import request1 from './request1.js'
// 版本更新测试
export const pdaUpdate = () => request({
@@ -252,6 +251,153 @@ export const bindVehicle = (code, type, vcode) => request({
vehicle_code: vcode
}
})
/**
* 定点作业
*/
// 查询设备
// export const queryDevice = () => request({
// url:'api/pda/queryDevice',
// data: {}
// })
export const queryDevice = () => {
let res = [
{
"region_code": "68",
"region_name": "构华",
"deviceArr": [
{
"point_code": "9",
"point_name": "京产"
}
]
},
{
"region_code": "8",
"region_name": "构华片资",
"deviceArr": [
{
"point_code": "19",
"point_name": "京产开向准"
}
]
}
]
return res
}
// 定点作业-确认
export const taskConfirm = (code1, code2) => request({
url:'api/pda/taskConfirm',
data: {
point_code1: code1,
point_code2: code2
}
})
/**
* 作业管理
*/
// 查询未完成指令
// export const pdaInsts = (keyword, scode, ncode) => request({
// url:'api/pda/insts',
// data: {
// keyword: keyword,
// start_devicecode: scode,
// next_devicecode: ncode
// }
// })
export const pdaInsts = () => {
let res = {
"code": "1",
"desc": "in",
"result": [
{
"inst_uuid": "51",
"task_no": "ADB001",
"start_devicecode": "46",
"next_devicecode": "2",
"inst_status": "0",
"priority": "一级",
"create_time": "1976-04-07 02:36:18",
"carrier": "890000008",
"instruction_code": '0000',
"carno": '1号车',
"inst_step": '1'
},
{
"inst_uuid": "5",
"task_no": "ADB001",
"start_devicecode": "46",
"next_devicecode": "2",
"inst_status": "0",
"priority": "一级",
"create_time": "1976-04-07 02:36:18",
"carrier": "890000008",
"instruction_code": '0000',
"carno": '1号车',
"inst_step": '1'
},
{
"inst_uuid": "1",
"task_no": "ADB001",
"start_devicecode": "46",
"next_devicecode": "2",
"inst_status": "2",
"priority": "一级",
"create_time": "1976-04-07 02:36:18",
"carrier": "890000008",
"instruction_code": '0000',
"carno": '1号车',
"inst_step": '1'
}
]
}
return res
}
// 指令操作
export const pdaInst = (type, uuid) => request({
url:'api/pda/inst',
data: {
type: type,
inst_uuid: uuid
}
})
/**
* 出库确认
*/
// 根据载具编码查询配盘信息
// export const queryGroupInfoByVehicle = (code) => request({
// url:'api/pda/queryGroupInfoByVehicle',
// data: {
// vehicle_code: code
// }
// })
export const queryGroupInfoByVehicle = (code) => {
let res = {
"point_code": "001",
"material_code": "100001",
"material_name": "垃圾了付定金",
"pcsn": "20202020",
"material_qty": "20.0"
}
return res
}
// 回库
export const vehicleGoBack = (code, vcode, num) => request({
url:'api/pda/vehicleGoBack',
data: {
point_code: code,
vehicle_code: vcode,
residue_num: num
}
})
// 出库确认
export const fullVehicleOutConfirm = (code, vcode, num) => request({
url:'api/pda/fullVehicleOutConfirm',
data: {
point_code: code,
vehicle_code: vcode,
residue_num: num
}
})
/**
* 任务流转
*/
@@ -314,27 +460,3 @@ export const queryPoints = (type) => request({
// ]
// return res
// }
//1.3余料回库
export const vehicleGoBack = (code, vcode, num) => request({
url:'api/pda/vehicleGoBack',
data: {
point_code: code,
vehicle_code: vcode,
residue_num: num
}
})
// 1.4满托出库确认
export const fullVehicleOutConfirm = (code, vcode, num) => request({
url:'api/pda/fullVehicleOutConfirm',
data: {
point_code: code,
vehicle_code: vcode,
residue_num: num
}
})

View File

@@ -1,126 +0,0 @@
import store from '@/vuex/store'
const request1 = (params) => {
let _self = this;
let url = params.url;
let method = params.method || 'POST';
let data = params.data || {};
// data.token = "default-access_token"
// if (!params.token) {
// let token = uni.getStorageSync('token');
// if (!token) {
// uni.navigateTo({
// url: '/pages/login/login'
// });
// } else {
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
// }
// }
let token = ''
if (store.getters.saveToken !== '') {
token = store.getters.saveToken
}
let defaultOpot = {
// 'Content-Type': 'application/x-www-form-urlencoded',
'Terminal-Type': 'innerH5',
'Content-Type': 'application/json;charset=UTF-8',
}
let header = {}
method = method.toUpperCase()
if (method == 'POST') {
header = {
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': token
}
// data = qs.stringify(data)
}
const requestUrl = url;
uni.showLoading({
title: '加载中...'
});
return new Promise((resolve, reject) => {
uni.request({
url: requestUrl,
method: method,
header: Object.assign({}, defaultOpot, header),
data: data,
dataType: 'json',
})
.then(res => { // 成功
if (res.length === 1) {
uni.showModal({
content: 'request:fail',
showCancel: false
})
reject('request:fail')
} else if (res[1] && res[1].statusCode === 400) {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
reject(res[1].data.message)
} else if (res[1] && res[1].statusCode === 401) {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
store.dispatch('delUserInfo')
uni.redirectTo({
url: '/pages/login/login'
})
} else if (res[1] && res[1].statusCode === 200) {
let {
data: dataType
} = res[1]
resolve(dataType)
// switch (dataType.code * 1) { // 拦截返回参数
// case 0:
// resolve(dataType)
// break;
// case 1003:
// uni.showModal({
// title: '登录已过期',
// content: '很抱歉,登录已过期,请重新登录',
// confirmText: '重新登录',
// success: function(res) {
// if (res.confirm) {
// uni.navigateTo({
// // 切记这儿需要哈pages.json保持一致不能有.vue后缀
// url: '/pages/login/login'
// });
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break;
// case -1:
// uni.showModal({
// title: '请求数据失败',
// content: '获取数据失败!',
// confirmText: '确定',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {} else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break
// }
}else {
uni.showModal({
content: res[1].data.message,
showCancel: false
})
reject(res[1].data.message)
}
})
.catch(err => { // 错误
reject(err)
})
.finally(() => {
uni.hideLoading();
})
})
}
export default request1

116
utils/utils.js Normal file
View File

@@ -0,0 +1,116 @@
/**
* yy-mm-dd
*/
export const dateFtt = date => {
if (date == null) {
return ''
}
let year = date.getFullYear()
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return `${year}-${month}-${day}`
}
/**
* yy-mm-dd hh:mm:ss
*/
export const dateTimeFtt = date => {
if (date == null) {
return ''
}
let year = date.getFullYear()
let month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
let hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
let mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
}
/**
* 将字符串形式的日期转换成日期对象
*/
export const dateNew = date => {
if (date === undefined || date === 'undefined') {
return new Date()
}
return new Date(Date.parse(date))
}
/**
* 小数加法
*/
export const accAdd = (arg1, arg2) => {
var r1, r2, m, c
try {
r1 = arg1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
c = Math.abs(r1 - r2)
m = Math.pow(10, Math.max(r1, r2))
if (c > 0) {
var cm = Math.pow(10, c)
if (r1 > r2) {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', '')) * cm
} else {
arg1 = Number(arg1.toString().replace('.', '')) * cm
arg2 = Number(arg2.toString().replace('.', ''))
}
} else {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', ''))
}
return (arg1 + arg2) / m
}
/**
* 小数减法
*/
export const accSubtract = (arg1, arg2) => {
var r1, r2, m, c
try {
r1 = arg1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
c = Math.abs(r1 - r2)
m = Math.pow(10, Math.max(r1, r2))
if (c > 0) {
var cm = Math.pow(10, c)
if (r1 > r2) {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', '')) * cm
} else {
arg1 = Number(arg1.toString().replace('.', '')) * cm
arg2 = Number(arg2.toString().replace('.', ''))
}
} else {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', ''))
}
return (arg1 - arg2) / m
}
/**
* 小数乘法
*/
export const accMul = (arg1, arg2) => {
var m = 0
var s1 = arg1.toString()
var s2 = arg2.toString()
try { m += s1.split('.')[1].length } catch (e) {}
try { m += s2.split('.')[1].length } catch (e) {}
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
}