退料建立,选择单位,工程可以互选,
This commit is contained in:
parent
39a81033d0
commit
3459699fcf
|
|
@ -91,7 +91,7 @@
|
||||||
if(!e.children){
|
if(!e.children){
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.showLabel=e.name;
|
this.showLabel=e.name;
|
||||||
this.$emit('change', e,index)
|
this.$emit('change', e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
clearInput(){
|
clearInput(){
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<view style="padding-top: 4vh;background-color: rgb(220, 244, 255);">
|
<view style="padding-top: 4vh; background-color: rgb(220, 244, 255)">
|
||||||
<uni-nav-bar left-icon="left" @clickLeft="leftClick" right-icon="scan" @clickRight="rightClick" title="退料新增" title-style="font-weight: bolder;" backgroundColor="rgb(220, 244, 255)" :border="false" />
|
<uni-nav-bar
|
||||||
</view>
|
left-icon="left"
|
||||||
|
@clickLeft="leftClick"
|
||||||
|
right-icon="scan"
|
||||||
|
@clickRight="rightClick"
|
||||||
|
title="退料新增"
|
||||||
|
title-style="font-weight: bolder;"
|
||||||
|
backgroundColor="rgb(220, 244, 255)"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<view class="accept page-common">
|
<view class="accept page-common">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<uni-forms :model="formData" label-width="170rpx" :border="true">
|
<uni-forms :model="formData" label-width="170rpx" :border="true">
|
||||||
<uni-forms-item label="退料单位:" name="unitId">
|
<uni-forms-item label="退料单位:" name="unitId">
|
||||||
<eselect style="width: 100%;height: 90rpx;"
|
<eselect
|
||||||
ref="treeSelect" :options="unitList" @change="getProject" @clear="clearUnit"></eselect>
|
style="width: 100%; height: 90rpx"
|
||||||
|
ref="treeSelect"
|
||||||
|
:options="unitList"
|
||||||
|
@change="getProject"
|
||||||
|
@clear="clearUnit"
|
||||||
|
></eselect>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="退料工程:" name="proId">
|
<uni-forms-item label="退料工程:" name="proId">
|
||||||
<eselect style="width: 100%;height: 90rpx;"
|
<eselect
|
||||||
ref="treeSelect2" :options="proList" @change="changePro" @clear="clearPro"></eselect>
|
style="width: 100%; height: 90rpx"
|
||||||
|
ref="treeSelect2"
|
||||||
|
:options="proList"
|
||||||
|
@change="changePro"
|
||||||
|
@clear="clearPro"
|
||||||
|
></eselect>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="退料人员:" name="backPerson">
|
<uni-forms-item label="退料人员:" name="backPerson">
|
||||||
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入退料人" />
|
<uni-easyinput v-model="backPerson" maxlength="10" placeholder="请输入退料人" />
|
||||||
|
|
@ -32,141 +51,163 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getUnitList,getProjectList,insertApp,getAgreementInfoById } from '../../services/back.js';
|
import {
|
||||||
import eselect from '@/components/tree-select/eselect.vue';
|
getUnitList,
|
||||||
|
getProjectList,
|
||||||
|
insertApp,
|
||||||
|
getAgreementInfoById,
|
||||||
|
} from '../../services/back.js'
|
||||||
|
import eselect from '@/components/tree-select/eselect.vue'
|
||||||
const treeSelect = ref(null)
|
const treeSelect = ref(null)
|
||||||
const treeSelect2 = ref(null)
|
const treeSelect2 = ref(null)
|
||||||
const formData = ref({})
|
const formData = ref({})
|
||||||
const unitId = ref("")
|
const unitId = ref('')
|
||||||
const proId = ref("")
|
const proId = ref('')
|
||||||
const agreementId = ref("")
|
const agreementId = ref('')
|
||||||
const unitList = ref([])
|
const unitList = ref([])
|
||||||
const proList = ref([])
|
const proList = ref([])
|
||||||
const backPerson = ref("")
|
const backPerson = ref('')
|
||||||
const phone = ref("")
|
const phone = ref('')
|
||||||
|
|
||||||
//单位
|
//单位
|
||||||
const getUnit = () => {
|
const getUnit = () => {
|
||||||
// proId.value=e.id;
|
// proId.value=e.id;
|
||||||
let obj = {
|
let obj = {
|
||||||
// "projectId":proId.value,
|
projectId: proId.value,
|
||||||
}
|
}
|
||||||
getUnitList(obj).then(res => {
|
getUnitList(obj)
|
||||||
console.log(res)
|
.then((res) => {
|
||||||
unitList.value = res.data;
|
console.log(res)
|
||||||
// getAgreement()
|
unitList.value = res.data
|
||||||
}).catch(error => {
|
// getAgreement()
|
||||||
console.log(error)
|
if (unitId.value && proId.value) {
|
||||||
})
|
getAgreement()
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
//工程
|
//工程
|
||||||
const getProject = (e) => {
|
const getProject = (e) => {
|
||||||
// console.log(e)
|
console.log('🚀 ~ getProject ~ e:', e)
|
||||||
unitId.value=e.id;
|
unitId.value = e?.id || ''
|
||||||
let obj = {
|
let obj = {
|
||||||
"unitId":unitId.value,
|
unitId: unitId.value,
|
||||||
// "isApp":true
|
// "isApp":true
|
||||||
}
|
}
|
||||||
getProjectList(obj).then(res => {
|
getProjectList(obj)
|
||||||
proList.value = res.data
|
.then((res) => {
|
||||||
proId.value=""
|
proList.value = res.data
|
||||||
treeSelect2.value.clearInput();
|
// proId.value=""
|
||||||
agreementId.value=""
|
// treeSelect2.value.clearInput();
|
||||||
// getAgreement()
|
agreementId.value = ''
|
||||||
}).catch(error => {
|
if (unitId.value && proId.value) {
|
||||||
console.log(error)
|
getAgreement()
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
const clearUnit = () =>{
|
const clearUnit = () => {
|
||||||
unitId.value="";
|
unitId.value = ''
|
||||||
agreementId.value=""
|
agreementId.value = ''
|
||||||
|
getUnit()
|
||||||
|
getProject()
|
||||||
}
|
}
|
||||||
const clearPro = () =>{
|
const clearPro = () => {
|
||||||
proId.value="";
|
proId.value = ''
|
||||||
agreementId.value=""
|
agreementId.value = ''
|
||||||
|
getProject()
|
||||||
|
getProject()
|
||||||
}
|
}
|
||||||
//工程选择
|
//工程选择
|
||||||
const changePro = (e) => {
|
const changePro = (e) => {
|
||||||
// console.log(e)
|
console.log(e)
|
||||||
proId.value=e.id
|
proId.value = e.id
|
||||||
getAgreement()
|
getUnit()
|
||||||
}
|
// getAgreement()
|
||||||
|
}
|
||||||
//协议
|
//协议
|
||||||
const getAgreement = () => {
|
const getAgreement = () => {
|
||||||
let obj = {
|
let obj = {
|
||||||
"unitId":unitId.value,
|
unitId: unitId.value,
|
||||||
"projectId":proId.value
|
projectId: proId.value,
|
||||||
}
|
}
|
||||||
getAgreementInfoById(obj).then(res => {
|
getAgreementInfoById(obj)
|
||||||
console.log(res)
|
.then((res) => {
|
||||||
if(res.code==200){
|
console.log(res)
|
||||||
agreementId.value=res.data.agreementId
|
if (res.code == 200) {
|
||||||
}else{
|
agreementId.value = res.data.agreementId
|
||||||
agreementId.value=""
|
} else {
|
||||||
}
|
agreementId.value = ''
|
||||||
}).catch(error => {
|
}
|
||||||
console.log(error)
|
})
|
||||||
})
|
.catch((error) => {
|
||||||
}
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
//清空
|
//清空
|
||||||
const clearForm = () => {
|
const clearForm = () => {
|
||||||
unitId.value=""
|
unitId.value = ''
|
||||||
proId.value=""
|
proId.value = ''
|
||||||
backPerson.value=""
|
backPerson.value = ''
|
||||||
phone.value=""
|
phone.value = ''
|
||||||
agreementId.value=""
|
agreementId.value = ''
|
||||||
treeSelect.value.clearInput()
|
treeSelect.value.clearInput()
|
||||||
treeSelect2.value.clearInput()
|
treeSelect2.value.clearInput()
|
||||||
getUnit()
|
getUnit()
|
||||||
// getProject()
|
// getProject()
|
||||||
}
|
}
|
||||||
//确认
|
//确认
|
||||||
const confirmAdd = () => {
|
const confirmAdd = () => {
|
||||||
if(agreementId.value==""){
|
if (agreementId.value == '') {
|
||||||
uni.showToast({ title: "请确认退料单位,退料工程!", icon: 'none' })
|
uni.showToast({ title: '请确认退料单位,退料工程!', icon: 'none' })
|
||||||
}else if(backPerson.value==""){
|
} else if (backPerson.value == '') {
|
||||||
uni.showToast({ title: "请确认退料人!", icon: 'none' })
|
uni.showToast({ title: '请确认退料人!', icon: 'none' })
|
||||||
}else if(phone.value==""){
|
} else if (phone.value == '') {
|
||||||
uni.showToast({ title: "请确认联系电话!", icon: 'none' })
|
uni.showToast({ title: '请确认联系电话!', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
let obj = {
|
let obj = {
|
||||||
"backApplyInfo":{
|
backApplyInfo: {
|
||||||
"agreementId":agreementId.value,
|
agreementId: agreementId.value,
|
||||||
"backPerson":backPerson.value,
|
backPerson: backPerson.value,
|
||||||
"phone":phone.value
|
phone: phone.value,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
insertApp(obj).then(res => {
|
insertApp(obj)
|
||||||
console.log(res)
|
.then((res) => {
|
||||||
if(res.code==200){
|
console.log(res)
|
||||||
uni.showToast({ title: '新增成功', icon: 'none' })
|
if (res.code == 200) {
|
||||||
uni.navigateBack({
|
uni.showToast({ title: '新增成功', icon: 'none' })
|
||||||
delta: 1 // 返回到已存在的页面
|
uni.navigateBack({
|
||||||
});
|
delta: 1, // 返回到已存在的页面
|
||||||
}else{
|
})
|
||||||
uni.showToast({ title: res.msg, icon: 'none' })
|
} else {
|
||||||
}
|
uni.showToast({ title: res.msg, icon: 'none' })
|
||||||
}).catch(error => {
|
}
|
||||||
console.log(error)
|
})
|
||||||
})
|
.catch((error) => {
|
||||||
}
|
console.log(error)
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
const leftClick = () => {
|
const leftClick = () => {
|
||||||
console.log(1)
|
console.log(1)
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1 // 返回到已存在的页面
|
delta: 1, // 返回到已存在的页面
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
const rightClick = () => {
|
const rightClick = () => {
|
||||||
console.log(2)
|
console.log(2)
|
||||||
uni.navigateTo({ url: `/pages/back/backCodeAdd` })
|
uni.navigateTo({ url: `/pages/back/backCodeAdd` })
|
||||||
}
|
}
|
||||||
onLoad((options)=>{
|
onLoad((options) => {
|
||||||
getUnit()
|
getUnit()
|
||||||
// getProject()
|
getProject()
|
||||||
// formData.value = JSON.parse(options.item)
|
// formData.value = JSON.parse(options.item)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,75 +5,83 @@
|
||||||
<uni-col :span="6">任务创建:</uni-col>
|
<uni-col :span="6">任务创建:</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="coding-btn" @click="codeScan">编码识别</view>
|
<view class="coding-btn" @click="codeScan">编码识别</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="coding-btn" @click="codeScan">二维码识别</view>
|
<view class="coding-btn" @click="codeScan">二维码识别</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
<uni-col :span="8">设备编码:</uni-col>
|
<uni-col :span="8">设备编码:</uni-col>
|
||||||
<uni-col :span="16">
|
|
||||||
{{ maInfo.maCode }}
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="6">退料单位:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
<uni-easyinput v-model="maInfo.unitName" maxlength="20" disabled="true"/>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="6">退料工程:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
<uni-easyinput v-model="maInfo.proName" maxlength="20" disabled="true"/>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="6">退料人:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
<uni-easyinput placeholder="请输入退料人" maxlength="10" v-model="backPerson"/>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="6">联系电话:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
<uni-easyinput placeholder="请输入联系电话" maxlength="11" v-model="phone"/>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="8">物资类型:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
{{ maInfo.typeName }}
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="8">规格型号:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
{{ maInfo.typeModelName }}
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="8">设备状态:</uni-col>
|
|
||||||
<uni-col :span="16">
|
|
||||||
{{ maInfo.maStatusName }}
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
|
||||||
<uni-col :span="6">外观判定:</uni-col>
|
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<uni-easyinput placeholder="请输入内容" v-model="apDetection"/>
|
{{ maInfo.maCode }}
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center;margin-bottom: 20px;">
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="6">退料单位:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
<uni-easyinput v-model="maInfo.unitName" maxlength="20" disabled="true" />
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="6">退料工程:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
<uni-easyinput v-model="maInfo.proName" maxlength="20" disabled="true" />
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="6">退料人:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
<uni-easyinput placeholder="请输入退料人" maxlength="10" v-model="backPerson" />
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="6">联系电话:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
<uni-easyinput placeholder="请输入联系电话" maxlength="11" v-model="phone" />
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="8">物资类型:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
{{ maInfo.typeName }}
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="8">规格型号:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
{{ maInfo.typeModelName }}
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="8">设备状态:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
{{ maInfo.maStatusName }}
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
|
<uni-col :span="6">外观判定:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
|
||||||
|
<radio-group v-model="apDetection" @change="changeRadio">
|
||||||
|
<radio value="完好" checked style="margin-right: 5px;">完好</radio>
|
||||||
|
<radio value="损坏">损坏</radio>
|
||||||
|
</radio-group>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 20px">
|
||||||
<uni-col :span="6">附件:</uni-col>
|
<uni-col :span="6">附件:</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<div class="upload" @click="uploadImg" v-if="imgBeseUrl==''">+</div>
|
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
|
||||||
<div class="upload" @click="uploadImg" v-else>
|
<div class="upload" @click="uploadImg" v-else>
|
||||||
<image :src="imgBeseUrl" style="width: 160rpx;height: 160rpx;" mode=""></image>
|
<image
|
||||||
</div>
|
:src="imgBeseUrl"
|
||||||
|
style="width: 160rpx; height: 160rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
|
</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -86,165 +94,181 @@
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, reactive } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getMachine,insertBack,getMachineByQrCodeApi } from '../../services/back.js';
|
import { getMachine, insertBack, getMachineByQrCodeApi } from '../../services/back.js'
|
||||||
import { baseURL } from '@/utils/http'
|
import { baseURL } from '@/utils/http'
|
||||||
const backPerson = ref("")
|
const backPerson = ref('')
|
||||||
const phone = ref("")
|
const phone = ref('')
|
||||||
const apDetection = ref("") //外观判定
|
const apDetection = ref('完好') //外观判定
|
||||||
const imgBeseUrl = ref("") //图片展示
|
const imgBeseUrl = ref('') //图片展示
|
||||||
const bmFileInfos = ref([])//图片数组
|
const bmFileInfos = ref([]) //图片数组
|
||||||
const qrCode = ref("") //二维码
|
const qrCode = ref('') //二维码
|
||||||
const maInfo = ref({}) //二维码
|
const maInfo = ref({}) //二维码
|
||||||
// 二维码扫码
|
// 二维码扫码
|
||||||
const codeScan = async () => {
|
const codeScan = async () => {
|
||||||
qrCode.value=""
|
qrCode.value = ''
|
||||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
var mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
|
||||||
mpaasScanModule.mpaasScan({
|
mpaasScanModule.mpaasScan(
|
||||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
{
|
||||||
'scanType': ['qrCode','barCode'],
|
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||||
// 是否隐藏相册,默认false不隐藏
|
scanType: ['qrCode', 'barCode'],
|
||||||
'hideAlbum': false,
|
// 是否隐藏相册,默认false不隐藏
|
||||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
hideAlbum: false,
|
||||||
'language' : 'en',
|
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||||
//相册选择照片识别错误提示(ios)
|
language: 'en',
|
||||||
'failedMsg': '未识别到二维码,请重试',
|
//相册选择照片识别错误提示(ios)
|
||||||
//Android支持全屏需要设置此参数
|
failedMsg: '未识别到二维码,请重试',
|
||||||
'screenType': 'full'
|
//Android支持全屏需要设置此参数
|
||||||
},(ret) => {
|
screenType: 'full',
|
||||||
console.log(ret)
|
},
|
||||||
if(ret.resp_code==10){
|
(ret) => {
|
||||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
console.log(ret)
|
||||||
maInfo.value = {}
|
if (ret.resp_code == 10) {
|
||||||
}
|
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||||
if(ret.resp_code==11){
|
maInfo.value = {}
|
||||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
}
|
||||||
}
|
if (ret.resp_code == 11) {
|
||||||
if(ret.resp_code==1000){
|
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||||
// uni.showToast({ title: '扫码成功', icon: 'none' })
|
}
|
||||||
qrCode.value = ret.resp_result;
|
if (ret.resp_code == 1000) {
|
||||||
codeToBack()
|
// uni.showToast({ title: '扫码成功', icon: 'none' })
|
||||||
}
|
qrCode.value = ret.resp_result
|
||||||
})
|
codeToBack()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
// 二维码
|
// 二维码
|
||||||
const codeToBack = async () => {
|
const codeToBack = async () => {
|
||||||
if(qrCode.value==""){
|
if (qrCode.value == '') {
|
||||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
let param = {
|
let param = {
|
||||||
qrCode: qrCode.value
|
qrCode: qrCode.value,
|
||||||
}
|
}
|
||||||
//通过二维码获取相绑定的设备编码
|
//通过二维码获取相绑定的设备编码
|
||||||
const res = await getMachineByQrCodeApi(param)
|
const res = await getMachineByQrCodeApi(param)
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(res.code==200){
|
if (res.code == 200) {
|
||||||
if(res.data.length>0){
|
if (res.data.length > 0) {
|
||||||
maInfo.value = res.data[0]
|
maInfo.value = res.data[0]
|
||||||
console.log('22222222',maInfo.value)
|
console.log('22222222', maInfo.value)
|
||||||
}else{
|
} else {
|
||||||
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'})
|
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none' })
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
uni.showToast({ title: res.data.msg, icon: 'none'})
|
uni.showToast({ title: res.data.msg, icon: 'none' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const changeRadio = (e) => {
|
||||||
|
console.log(e.detail.value)
|
||||||
|
apDetection.value = e.detail.value
|
||||||
}
|
}
|
||||||
|
|
||||||
//提交
|
//提交
|
||||||
const submitCode = () => {
|
const submitCode = () => {
|
||||||
if(maInfo.value.agreementId==undefined){
|
if (maInfo.value.agreementId == undefined) {
|
||||||
uni.showToast({ title: "请先扫码确认退料单位,退料工程!", icon: 'none' })
|
uni.showToast({ title: '请先扫码确认退料单位,退料工程!', icon: 'none' })
|
||||||
}else if(backPerson.value==""){
|
} else if (backPerson.value == '') {
|
||||||
uni.showToast({ title: "请填写退料人!", icon: 'none' })
|
uni.showToast({ title: '请填写退料人!', icon: 'none' })
|
||||||
}else if(phone.value==""){
|
} else if (phone.value == '') {
|
||||||
uni.showToast({ title: "请确认联系电话!", icon: 'none' })
|
uni.showToast({ title: '请确认联系电话!', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
let info = {
|
let info = {
|
||||||
agreementId:maInfo.value.agreementId,
|
agreementId: maInfo.value.agreementId,
|
||||||
backPerson:backPerson.value,
|
backPerson: backPerson.value,
|
||||||
phone:phone.value,
|
phone: phone.value,
|
||||||
proId:maInfo.value.proId,
|
proId: maInfo.value.proId,
|
||||||
unitId:maInfo.value.unitId
|
unitId: maInfo.value.unitId,
|
||||||
}
|
}
|
||||||
let detail = [{
|
let detail = [
|
||||||
"maId":maInfo.value.maId,
|
{
|
||||||
"maCode":maInfo.value.maCode,
|
maId: maInfo.value.maId,
|
||||||
"typeId":maInfo.value.typeId,
|
maCode: maInfo.value.maCode,
|
||||||
"apDetection":apDetection.value,
|
typeId: maInfo.value.typeId,
|
||||||
"bmFileInfos":bmFileInfos.value,
|
apDetection: apDetection.value,
|
||||||
"preNum":1,
|
bmFileInfos: bmFileInfos.value,
|
||||||
}]
|
preNum: 1,
|
||||||
let param = {
|
},
|
||||||
"backApplyInfo":info,
|
]
|
||||||
"backApplyDetailsList":detail
|
let param = {
|
||||||
}
|
backApplyInfo: info,
|
||||||
insertBack(param).then(res => {
|
backApplyDetailsList: detail,
|
||||||
console.log(res)
|
}
|
||||||
if(res.code==200){
|
insertBack(param)
|
||||||
uni.showToast({ title: '新增成功', icon: 'none' })
|
.then((res) => {
|
||||||
uni.navigateBack({
|
console.log(res)
|
||||||
delta: 1 // 返回到已存在的页面
|
if (res.code == 200) {
|
||||||
});
|
uni.showToast({ title: '新增成功', icon: 'none' })
|
||||||
}else{
|
uni.navigateBack({
|
||||||
uni.showToast({ title: res.msg, icon: 'none' })
|
delta: 1, // 返回到已存在的页面
|
||||||
}
|
})
|
||||||
}).catch(error => {
|
} else {
|
||||||
console.log(error)
|
uni.showToast({ title: res.msg, icon: 'none' })
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
}
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//上传
|
//上传
|
||||||
const uploadImg = () => {
|
const uploadImg = () => {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //图片可选择数量
|
count: 1, //图片可选择数量
|
||||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||||
success: res => {
|
success: (res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||||
imgBeseUrl.value = imgFiles[0]
|
imgBeseUrl.value = imgFiles[0]
|
||||||
// console.log('本地地址', imgFiles)
|
// console.log('本地地址', imgFiles)
|
||||||
// console.log('请求地址', baseURL+"/file/upload")
|
// console.log('请求地址', baseURL+"/file/upload")
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
// url: baseURL+"/file/upload",//app
|
// url: baseURL+"/file/upload",//app
|
||||||
url: "/file/upload",//h5
|
url: '/file/upload', //h5
|
||||||
filePath: imgFiles[0],
|
filePath: imgFiles[0],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res = JSON.parse(res.data)
|
res = JSON.parse(res.data)
|
||||||
console.log('上传成功', res.code);
|
console.log('上传成功', res.code)
|
||||||
console.log('上传成功', res.data);
|
console.log('上传成功', res.data)
|
||||||
if(res.code&&res.code==200){
|
if (res.code && res.code == 200) {
|
||||||
let obj = {
|
let obj = {
|
||||||
"name":res.data.name,
|
name: res.data.name,
|
||||||
"url":res.data.url,
|
url: res.data.url,
|
||||||
"taskType":"10"
|
taskType: '10',
|
||||||
}
|
}
|
||||||
// console.log(obj)
|
// console.log(obj)
|
||||||
bmFileInfos.value = [obj]
|
bmFileInfos.value = [obj]
|
||||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
bmFileInfos.value = []
|
bmFileInfos.value = []
|
||||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('上传失败', err);
|
console.error('上传失败', err)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
// this.$refs.vForm.clearValidate()
|
// this.$refs.vForm.clearValidate()
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad((options)=>{
|
onLoad((options) => {
|
||||||
console.log(options)
|
console.log(options)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .uni-radio-input {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
.accept {
|
.accept {
|
||||||
padding: 24rpx;
|
padding: 24rpx;
|
||||||
height: 95vh;
|
height: 95vh;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue