|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="register">
|
|
|
<van-nav-bar
|
|
|
- title="加工建单" left-arrow fixed placeholder @click-left="goBack" @click-right="onConfirm()">
|
|
|
+ title="加工建单" left-arrow fixed placeholder @click-left="historyBack" @click-right="onConfirm()">
|
|
|
<template #left>
|
|
|
<van-icon name="arrow-left" size="25" />
|
|
|
<div style="color: #fff">返回</div>
|
|
|
@@ -10,21 +10,26 @@
|
|
|
<div style="color: #fff">提交</div>
|
|
|
</template>
|
|
|
</van-nav-bar>
|
|
|
- <van-field v-model="date" type="text" label="登记日期" placeholder="请选择日期"
|
|
|
- readonly is-link input-align="right" @click="dateTrueFalseBy=true" required
|
|
|
- />
|
|
|
- <van-field v-model="ownerCode" type="text" label="登记货主" placeholder="请选择货主" readonly
|
|
|
- is-link @click="ownerRef.show(1)" input-align="right" required
|
|
|
+
|
|
|
+ <van-field v-model="taskDetail.code" type="text" label="任务号" placeholder="任务号"
|
|
|
+ readonly input-align="right" required
|
|
|
/>
|
|
|
- <van-field v-model="code" type="textarea" label="单据信息" placeholder="请填写快递单号/收货任务号,多个用逗号/空格/换行符进行分割"
|
|
|
- show-word-limit maxlength="500" rows="2" autosize required
|
|
|
+<!-- <van-field v-model="date" type="text" label="登记日期" placeholder="请选择日期"-->
|
|
|
+<!-- readonly is-link input-align="right" @click="dateTrueFalseBy=true" required-->
|
|
|
+<!-- />-->
|
|
|
+ <van-field v-model="taskDetail.owner" type="text" label="登记货主" placeholder="请选择货主" readonly
|
|
|
+ input-align="right" required
|
|
|
/>
|
|
|
+<!-- is-link @click="ownerRef.show(1)" -->
|
|
|
+<!-- <van-field v-model="code" type="textarea" label="单据信息" placeholder="请填写快递单号/收货任务号,多个用逗号/空格/换行符进行分割"-->
|
|
|
+<!-- show-word-limit maxlength="500" rows="2" autosize required-->
|
|
|
+<!-- />-->
|
|
|
<van-field v-model="note" type="textarea" label=" 备注信息" placeholder="请输入备注信息"
|
|
|
- show-word-limit maxlength="500" rows="1" autosize
|
|
|
+ show-word-limit maxlength="500" rows="2" autosize
|
|
|
/>
|
|
|
<div class="register-content">
|
|
|
<div class="add-type">
|
|
|
- <van-button type="primary" round size="small" @click="addType">添加类型</van-button>
|
|
|
+ <van-button type="primary" round size="small" @click="addType({})">添加类型</van-button>
|
|
|
</div>
|
|
|
<div class="type-box">
|
|
|
<div class="type-title">类型表一览</div>
|
|
|
@@ -32,16 +37,19 @@
|
|
|
<div class="type-item">
|
|
|
<div class="type-item-item">类型</div>
|
|
|
<div class="type-item-operate">数量</div>
|
|
|
- <div class="type-item-operate">操作</div>
|
|
|
+ <div class="type-item-operate" >操作</div>
|
|
|
</div>
|
|
|
<div class="type-item" v-for="(item,index) in typeList" v-if="typeList.length>0">
|
|
|
<div class="type-item-item">{{getOperate(item.operate)}}</div>
|
|
|
<div class="type-item-operate">{{item.expectAmount}}</div>
|
|
|
- <div class="type-item-delete" @click="del(item,index)" >删除</div>
|
|
|
+ <div style="display: flex" >
|
|
|
+<!-- <span class="type-item-update" @click="addType(item)" >修改</span>-->
|
|
|
+ <span class="type-item-delete" @click="del(item,index)" >删除</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<van-empty :image="<string>nodataUrl" image-size="140" >
|
|
|
- <van-button round type="primary" class="bottom-button" size="small" @click="addType">添加</van-button>
|
|
|
+ <van-button round type="primary" class="bottom-button" size="small" @click="addType({})">添加</van-button>
|
|
|
</van-empty>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -62,11 +70,12 @@ import { useStore } from '@/store/modules/user'
|
|
|
import { closeLoading, showLoading } from '@/utils/loading'
|
|
|
import Owner from '@/components/Owner.vue'
|
|
|
import { formatDate } from '@/utils/date'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import nodataUrl from '@/assets/nodata.png'
|
|
|
import AddRegisterType from '@/views/processing/register/components/addRegisterType.vue'
|
|
|
-import { createProcessing, getProcessingTypeList } from '@/api/processing'
|
|
|
+import { createProcessing, getProcessingDetail, getProcessingTypeList } from '@/api/processing'
|
|
|
import { toArray, toMap } from '@/utils/dataType'
|
|
|
+const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
try {
|
|
|
getHeader()
|
|
|
@@ -81,6 +90,7 @@ const ownerCode = ref('')
|
|
|
const date = ref(formatDate(new Date()))
|
|
|
const note = ref('')
|
|
|
const code=ref('')
|
|
|
+const taskDetail=ref({}) //任务详情
|
|
|
const processingTypeList=ref([])
|
|
|
const processingTypeMap=ref({})
|
|
|
//添加类型
|
|
|
@@ -97,23 +107,43 @@ const dateConfirm = (e) => {
|
|
|
date.value = formatDate(e)
|
|
|
dateTrueFalseBy.value = false
|
|
|
}
|
|
|
+
|
|
|
+// 获取详情
|
|
|
+const getDetail=()=>{
|
|
|
+ showLoading()
|
|
|
+ getProcessingDetail({code:route.query.code}).then(res => {
|
|
|
+ taskDetail.value=res.data
|
|
|
+ ownerCode.value = res.data.ownerId
|
|
|
+ typeList.value=res.data.typeList
|
|
|
+ note.value=res.data.processNote
|
|
|
+ }).catch(err=>{
|
|
|
+ taskDetail.value={}
|
|
|
+ scanError()
|
|
|
+ showNotify({ type: 'warning', duration: 3000, message: '详情获取失败正在返回上一页' })
|
|
|
+ router.push({name:'Processing'})
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ closeLoading()
|
|
|
+ })
|
|
|
+}
|
|
|
+getDetail()
|
|
|
//提交登记
|
|
|
const onConfirm = () => {
|
|
|
- if(!ownerCode.value){
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '请选择货主' })
|
|
|
- scanError()
|
|
|
- return
|
|
|
- }
|
|
|
+ // if(!ownerCode.value){
|
|
|
+ // showNotify({ type: 'warning', duration: 3000, message: '请选择货主' })
|
|
|
+ // scanError()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
if(typeList.value.length==0){
|
|
|
showNotify({ type: 'warning', duration: 3000, message: '请先添加单据类型' })
|
|
|
scanError()
|
|
|
return
|
|
|
}
|
|
|
- if(!code.value){
|
|
|
- showNotify({ type: 'warning', duration: 3000, message: '请先添加单据信息' })
|
|
|
- scanError()
|
|
|
- return
|
|
|
- }
|
|
|
+ // if(!code.value){
|
|
|
+ // showNotify({ type: 'warning', duration: 3000, message: '请先添加单据信息' })
|
|
|
+ // scanError()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
showConfirmDialog({
|
|
|
title: '温馨提示', message:'是否确认建单' })
|
|
|
@@ -123,20 +153,22 @@ const onConfirm = () => {
|
|
|
}
|
|
|
|
|
|
const _createProcessing=()=>{
|
|
|
- const data={owner:ownerItem.value.id,ownerCode:ownerItem.value.code,note:note.value,warehouse,typeList:typeList.value,noList:toArray(code.value)}
|
|
|
+ const data={id:taskDetail.value.id,note:note.value,warehouse,typeList:typeList.value}
|
|
|
showLoading()
|
|
|
createProcessing(data).then(res=>{
|
|
|
closeLoading()
|
|
|
scanSuccess()
|
|
|
showConfirmDialog({
|
|
|
- title: '建单成功',
|
|
|
+ title: '提示',
|
|
|
message:`加工单号为:${res.data}`,
|
|
|
confirmButtonText:'复制'
|
|
|
})
|
|
|
.then(() => {
|
|
|
copyText(res.data)
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ router.push({name:'Processing'})
|
|
|
+ });
|
|
|
reset()
|
|
|
}).catch(err=>{
|
|
|
scanError()
|
|
|
@@ -152,6 +184,7 @@ const copyText=(txt) =>{
|
|
|
const successful = document.execCommand('copy');
|
|
|
if (successful) {
|
|
|
showNotify({ type: 'success', duration: 3000, message: '已复制' })
|
|
|
+ router.push({name:'Processing'})
|
|
|
} else {
|
|
|
console.error('复制失败');
|
|
|
}
|
|
|
@@ -161,6 +194,9 @@ const copyText=(txt) =>{
|
|
|
document.body.removeChild(textarea);
|
|
|
}
|
|
|
}
|
|
|
+const historyBack=()=>{
|
|
|
+ history.back();
|
|
|
+}
|
|
|
const reset=()=>{
|
|
|
code.value=""
|
|
|
typeList.value=[]
|
|
|
@@ -168,11 +204,12 @@ const reset=()=>{
|
|
|
ownerCode.value=''
|
|
|
}
|
|
|
//添加类型
|
|
|
-const addType=()=>{
|
|
|
- addRegisterTypeRef.value?.show(typeList.value)
|
|
|
+const addType=(item)=>{
|
|
|
+ console.log(item,"item")
|
|
|
+ addRegisterTypeRef.value?.show(typeList.value,item)
|
|
|
}
|
|
|
const setProcessingType=(data)=>{
|
|
|
- typeList.value.push(data)
|
|
|
+ typeList.value.push(data);
|
|
|
}
|
|
|
//转换类型名称
|
|
|
const getOperate=(operate)=>{
|
|
|
@@ -228,6 +265,11 @@ window.onRefresh = loadData
|
|
|
text-align: center
|
|
|
color: #ff4141
|
|
|
text-decoration: underline
|
|
|
+ .type-item-update
|
|
|
+ width: 50px
|
|
|
+ text-align: center
|
|
|
+ color: #1861e0
|
|
|
+ text-decoration: underline
|
|
|
.type-item:last-child
|
|
|
border-bottom: none
|
|
|
|