mt-ck-wms-ui/src/views/basicData/Warehouse/HistoricalTask.vue
2022-03-14 10:59:13 +08:00

278 lines
7.1 KiB
Vue

<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2022-03-14 10:37:13
* @Description:
-->
<template>
<div class="app-container">
<el-form
ref="formData"
:model="formData"
:inline="true"
size="medium"
label-width="100px"
>
<el-form-item :label="$t('module.basicData.Warehouse.TaskType')" prop="taskType">
<el-select v-model="formData.taskType" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.TaskType')])" clearable>
<el-option
v-for="item in taskTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.Warehouse.TaskStatus')" prop="status">
<el-select v-model="formData.status" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.TaskStatus')])" clearable>
<el-option
v-for="item in TaskStatusList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.Warehouse.VehicleName')" prop="equipmentId">
<el-select v-model="formData.equipmentId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.VehicleName')])" clearable>
<el-option
v-for="item in VehicleNameList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item :label="$t('module.basicData.Warehouse.TimeSlot')" prop="time">
<el-date-picker
v-model="formData.timeSlot"
type="daterange"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:start-placeholder="$t('module.orderManage.order.StartTime')"
:end-placeholder="$t('module.orderManage.order.StartTime')"
:range-separator="$t('module.orderManage.order.To')"
clearable
/>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
</el-form-item>
</el-form>
<base-table
:page="formData.current"
:limit="formData.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="formData.current"
:limit.sync="formData.size"
@pagination="getList()"
/>
<historical-task-info v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
</template>
<script>
import { HistoricalTaskList } from '@/api/basicData/Warehouse/HistoricalTask'
import HistoricalTaskInfo from './components/HistoricalTaskInfo.vue'
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'view',
btnName: 'btn.see'
}
]
const tableProps = [
{
prop: 'taskCode',
label: i18n.t('module.basicData.Warehouse.Code'),
align: 'center'
},
{
prop: 'createTime',
label: i18n.t('module.basicData.Warehouse.ExecutionTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'taskSource',
label: i18n.t('module.basicData.Warehouse.TaskSource'),
align: 'center'
},
{
prop: 'taskType',
label: i18n.t('module.basicData.Warehouse.TaskType'),
align: 'center'
},
{
prop: 'fullCode',
label: i18n.t('module.basicData.Warehouse.TaskBoxNumber'),
align: 'center'
},
{
prop: 'emptyCode',
label: i18n.t('module.basicData.Warehouse.FullBoxNumber'),
align: 'center'
},
{
prop: 'wcurrProcessCode',
label: i18n.t('module.basicData.Warehouse.PreviousOperation'),
align: 'center'
},
{
prop: 'wnextProcessCode',
label: i18n.t('module.basicData.Warehouse.NextOperation'),
align: 'center'
},
{
prop: 'anotherCurrLocation',
label: i18n.t('module.basicData.Warehouse.StartLocation'),
align: 'center'
},
{
prop: 'anotherTargetLocation',
label: i18n.t('module.basicData.Warehouse.TargetLocation'),
align: 'center'
},
{
prop: 'currLocation',
label: i18n.t('module.basicData.Warehouse.FullBoxStartLocation'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.Warehouse.VehicleName'),
align: 'center'
}
]
export default {
name: 'ScrapInfo',
components: { Pagination, BaseTable, MethodBtn, HistoricalTaskInfo },
data() {
return {
trueWidth: 100,
addOrUpdateVisible: false,
tableProps,
tableBtn,
list: [],
total: 0,
listLoading: false,
formData: {
taskType: '',
status: '',
equipmentId: '',
// timeSlot: [],
// endTime: '',
// startTime: '',
current: 1,
size: 10
},
taskTypeList: [{
'label': '出库',
'value': 0
}, {
'label': '入库',
'value': 1
}, {
'label': '流转',
'value': 2
}],
TaskStatusList: [{
'label': '初始化',
'value': 0
}, {
'label': '损坏',
'value': 1
}],
VehicleNameList: [{
'label': '小车1',
'value': 0
}, {
'label': '小车2',
'value': 1
}]
}
},
created() {
this.getList()
},
methods: {
getList() {
// if (this.formData.timeSlot) {
// this.formData.startTime = this.formData.timeSlot[0]
// this.formData.endTime = this.formData.timeSlot[1]
// } else {
// this.formData.startTime = ''
// this.formData.endTime = ''
// }
this.listLoading = true
HistoricalTaskList(this.formData).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
handleClick(raw) {
console.log(raw)
this.addNew(raw.data.id)
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>