Files
longdianningxing/lms/nladmin-ui/src/views/wms/st/vehiclebill/out/index.vue

218 lines
7.5 KiB
Vue
Raw Normal View History

2022-10-08 13:44:33 +08:00
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="90px"
label-suffix=":"
>
<el-form-item label="单据编号">
<el-input
v-model="query.bill_code"
clearable
placeholder="单据编号"
style="width: 185px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:loading="loading"
:disabled="crud.selections.length !== 1"
@click="createTask"
>
生成任务
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="550px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
<el-form-item label="数量:" prop="vehicle_qty">
<el-input v-model="form.vehicle_qty" style="width: 370px;" />
</el-form-item>
<el-form-item label="起始点位:">
<el-input v-model="form.start_point_name" style="width: 370px;" @focus="openStartPonit" />
</el-form-item>
<el-form-item label="下一点位:" prop="next_point_code">
<el-input v-model="form.next_point_name" style="width: 370px;" @focus="openEndPonit" />
</el-form-item>
<el-form-item label="备注:">
<el-input v-model="form.remark" type="textarea" style="width: 370px;" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="record_uuid" label="记录标识" />
<el-table-column prop="bill_code" label="单据编号" show-overflow-tooltip />
<el-table-column prop="bill_status" label="单据状态">
<template slot-scope="scope">
{{ dict.label.st_bill_status[scope.row.bill_status] }}
</template>
</el-table-column>
<el-table-column prop="start_point_code" label="起始点位" />
<el-table-column prop="next_point_code" label="下一点位" />
<el-table-column prop="start_region_name" label="起始区域" />
<el-table-column prop="endt_region_name" label="终点区域" />
<el-table-column prop="vehicle_qty" label="数量" />
<el-table-column prop="task_uuid" label="任务标识" show-overflow-tooltip />
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" width="150px" />
<el-table-column prop="update_optname" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="150px" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
<PointDialog :dialog-show.sync="pointDialog" @tableChanged2="tableChanged2" />
</div>
</template>
<script>
import crudOutemptyvehicl from '@/views/wms/st/vehiclebill/out/outemptyvehicl'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import PointDialog from '@/views/wms/st/vehiclebill/PointDialog'
const defaultForm = {
record_uuid: null,
bill_code: null,
io_type: null,
bill_status: null,
vehicle_qty: null,
start_point_code: null,
next_point_code: null,
start_point_name: null,
next_point_name: null,
start_region_id: null,
end_region_id: null,
task_uuid: null,
remark: null,
create_id: null,
create_name: null,
create_time: null,
update_optid: null,
update_optname: null,
update_time: null,
is_delete: null
}
export default {
name: 'Outemptyvehicle',
dicts: ['st_bill_status'],
components: { pagination, crudOperation, rrOperation, udOperation, PointDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '空载具出库',
url: 'api/outemptyvehicle',
idField: 'record_uuid',
sort: 'record_uuid,desc',
crudMethod: { ...crudOutemptyvehicl },
optShow: {
add: true,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
pointDialog: false,
is_startAndEnd: null,
loading: false,
permission: {},
rules: {
vehicle_qty: [
{ required: true, message: '数量不能为空', trigger: 'blur' }
],
start_point_code: [
{ required: true, message: '起始点位不能为空', trigger: 'blur' }
],
next_point_code: [
{ required: true, message: '终点点位不能为空', trigger: 'blur' }
]
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
openStartPonit() {
// 1代表起始点位 2代表终点点位
this.is_startAndEnd = '1'
this.pointDialog = true
},
openEndPonit() {
// 1代表起始点位 2代表终点点位
this.is_startAndEnd = '2'
this.pointDialog = true
},
tableChanged2(row) {
if (this.is_startAndEnd === '1') {
this.form.start_point_code = row.point_code
this.form.start_point_name = row.point_name
}
if (this.is_startAndEnd === '2') {
this.form.next_point_code = row.point_code
this.form.next_point_name = row.point_name
}
},
createTask() {
const _selectData = this.$refs.table.selection
if (_selectData[0].bill_status !== '10') {
return this.crud.notify('只能对生成状态的单据生成任务', CRUD.NOTIFICATION_TYPE.INFO)
}
const data = _selectData[0]
this.loading = true
crudOutemptyvehicl.createTask(data).then(res => {
this.crud.toQuery()
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.loading = false
}).cache(() => {
this.loading = false
})
}
}
}
</script>
<style scoped>
</style>