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