<template>
|
<el-dialog
|
width="30%"
|
title="货盘运输任务"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="part-dialog"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
>
|
<el-form-item label="申请人" prop="staffName">
|
<el-input v-model="dataForm.staffName" placeholder="" readonly>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openStaffDialog()"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`saveSelectRow`"
|
>确 定</el-button
|
>
|
</div>
|
<staffDialog
|
:currshowlist.sync="showStaff"
|
@listenToStaffEvent="selectStaffCallback"
|
/>
|
</el-dialog>
|
</template>
|
<script>
|
import {
|
addPalletTransports,
|
putPalletTransports,
|
getPalletTransportsObj
|
} from '@/api/warehouse/pallettransports'
|
import staffDialog from '@/views/common/staff.vue'
|
export default {
|
components: {
|
staffDialog
|
},
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
palletTransportsId: {
|
type: Number,
|
default: 0
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
dataForm: {
|
id: 0,
|
applyStaffId: null,
|
staffName: null
|
},
|
dataRule: {},
|
isSubmit: false,
|
showStaff: false
|
}
|
},
|
methods: {
|
openStaffDialog() {
|
this.showStaff = true
|
},
|
selectStaffCallback(param) {
|
if (param) {
|
this.dataForm.applyStaffId = param.id
|
this.dataForm.staffName = param.staffName
|
}
|
},
|
saveSelectRow() {
|
this.isSubmit = true
|
if (this.dataForm.id) {
|
putPalletTransports(this.dataForm)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.innerVisible = false
|
this.$message.success('货盘运输任务修改成功')
|
this.$emit('refreshPalletTransports')
|
} else {
|
this.$message.error('货盘运输任务修改失败')
|
}
|
this.isSubmit = false
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
} else {
|
addPalletTransports(this.dataForm)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.innerVisible = false
|
this.$message.success('货盘运输任务新增成功')
|
this.$emit('refreshPalletTransports')
|
} else {
|
this.$message.error('货盘运输任务新增失败')
|
}
|
this.isSubmit = false
|
})
|
.catch(() => {
|
this.isSubmit = false
|
})
|
}
|
},
|
initData() {
|
this.dataForm.id = 0
|
this.dataForm.applyStaffId = null
|
this.dataForm.staffName = null
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.initData()
|
this.$nextTick(() => {
|
if (this.palletTransportsId) {
|
// 查询对应货盘运输任务的数据
|
getPalletTransportsObj(this.palletTransportsId).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
this.dataForm.id = resData.data.id
|
this.dataForm.applyStaffId = resData.data.applyStaffId
|
this.dataForm.staffName = resData.data.staffName
|
} else {
|
this.$message.error('获取货盘运输任务失败')
|
}
|
})
|
}
|
})
|
}
|
}
|
}
|
}
|
</script>
|
<style>
|
.part-dialog .el-dialog__header {
|
padding: 10px 20px 10px;
|
}
|
.part-dialog .el-dialog__header .el-dialog__headerbtn {
|
top: 10px;
|
}
|
.part-dialog .el-dialog__body {
|
padding: 5px 20px;
|
}
|
|
.part-dialog .el-dialog__footer {
|
padding: 5px 20px 10px;
|
}
|
|
.part-dialog .el-dialog__body .avue-crud__pagination {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
}
|
</style>
|