mt-ck-wms-ui/src/views/QualityManager/QCPplan.vue

179 lines
4.1 KiB
Vue
Raw Normal View History

2022-03-03 16:15:01 +08:00
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
2022-03-04 10:44:28 +08:00
* @LastEditTime: 2022-03-04 09:22:58
2022-03-03 16:15:01 +08:00
* @Description:
-->
<template>
<div class="app-container">
2022-03-04 10:44:28 +08:00
<el-form
ref="formData"
:rules="rules"
:model="listQuery"
:inline="true"
size="medium"
label-width="100px"
>
<el-form-item :label="$t('module.basicData.Warehouse.TimeSlot')" prop="time">
<el-date-picker
v-model="listQuery.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>
2022-03-03 16:15:01 +08:00
<base-table
:page="listQuery.current"
:limit="listQuery.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="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
2022-03-04 10:44:28 +08:00
<Factory-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
2022-03-03 16:15:01 +08:00
</div>
</template>
<script>
2022-03-04 10:44:28 +08:00
import FactoryAdd from './components/ExecutionInfoDetail.vue'
2022-03-03 16:15:01 +08:00
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'
2022-03-04 10:44:28 +08:00
import i18n from '@/lang'
2022-03-03 16:15:01 +08:00
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
2022-03-04 10:44:28 +08:00
type: 'see',
btnName: 'btn.see'
2022-03-03 16:15:01 +08:00
}
]
const tableProps = [
{
2022-03-04 10:44:28 +08:00
prop: 'name',
label: i18n.t('module.quality.QCPplan.QCPcode'),
2022-03-03 16:15:01 +08:00
align: 'center'
},
{
2022-03-04 10:44:28 +08:00
prop: 'createTime',
label: i18n.t('module.quality.QCPplan.getTime'),
filter: timeFormatter,
2022-03-03 16:15:01 +08:00
align: 'center'
}
]
export default {
2022-03-04 10:44:28 +08:00
name: 'ExecutionInfo',
components: { Pagination, BaseTable, MethodBtn, FactoryAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
2022-03-03 16:15:01 +08:00
data() {
return {
addOrUpdateVisible: false,
tableBtn,
2022-03-04 10:44:28 +08:00
trueWidth: 200,
2022-03-03 16:15:01 +08:00
tableProps,
list: [],
total: 0,
listLoading: true,
2022-03-04 10:44:28 +08:00
rules: {},
2022-03-03 16:15:01 +08:00
listQuery: {
current: 1,
2022-03-04 10:44:28 +08:00
size: 10,
timeSlot: []
2022-03-03 16:15:01 +08:00
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
2022-03-04 10:44:28 +08:00
this.addNew(raw.data.id)
},
getList() {
// this.listLoading = true
if (this.listQuery.timeSlot) {
this.listQuery.startTime = this.listQuery.timeSlot[0]
this.listQuery.endTime = this.listQuery.timeSlot[1]
} else {
this.listQuery.startTime = ''
this.listQuery.endTime = ''
2022-03-03 16:15:01 +08:00
}
2022-03-04 10:44:28 +08:00
// ExecutionInfoList(this.listQuery).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
// })
2022-03-03 16:15:01 +08:00
},
2022-03-04 10:44:28 +08:00
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
2022-03-03 16:15:01 +08:00
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>