288 lines
7.7 KiB
Vue
288 lines
7.7 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2020-12-29 15:41:11
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2022-03-16 09:54:40
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="formData"
|
|
:inline="true"
|
|
size="medium"
|
|
>
|
|
<el-form-item :label="$t('module.basicData.ScrapInfo.PlateId')" prop="substrateId">
|
|
<el-input v-model="formData.substrateId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.PlateId')])" style="width:200px" clearable />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.basicData.ScrapInfo.TimePeriod')" prop="time">
|
|
<el-date-picker
|
|
v-model="formData.timeSlot"
|
|
type="daterange"
|
|
format="yyyy-MM-dd"
|
|
:start-placeholder="$t('module.basicData.ScrapInfo.StartTime')"
|
|
:end-placeholder="$t('module.basicData.ScrapInfo.EndTime')"
|
|
:range-separator="$t('module.basicData.ScrapInfo.To')"
|
|
clearable
|
|
/>
|
|
<!-- value-format="yyyy-MM-dd" -->
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.basicData.ScrapInfo.name')" prop="equipmentId">
|
|
<el-select v-model="formData.equipmentId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.name')])" clearable :style="{width: '100%'}" filterable>
|
|
<el-option
|
|
v-for="(item, index) in device"
|
|
:key="index"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('module.basicData.ScrapInfo.workOrderName')" prop="orderId">
|
|
<el-select v-model="formData.orderId" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.ScrapInfo.workOrderName')])" clearable :style="{width: '100%'}" filterable>
|
|
<el-option
|
|
v-for="(item, index) in orderList"
|
|
:key="index"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" @click="getList()"> {{ 'btn.search' | i18nFilter }} </el-button>
|
|
<el-button type="primary" @click="addNew()"> {{ 'btn.add' | i18nFilter }} </el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<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="formData.current"
|
|
:limit.sync="formData.size"
|
|
@pagination="getList()"
|
|
/>
|
|
<ScrapInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getScrapList, delScrapInfo } from '@/api/quality-manage/scrap'
|
|
import { scrapReasonList } from '@/api/dict'
|
|
import ScrapInfoAdd from './ScrapInfo-add.vue'
|
|
// import ScrapInfoCause from './ScrapInfoCause.vue'
|
|
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'
|
|
import i18n from '@/lang'
|
|
import { getEqList } from '@/api/equipment/maintain'
|
|
import { ExecutionInfoList } from '@/api/orderManage/00A'
|
|
// import DictFilter from '@/components/BaseTable/subcomponents/DataDictFilter'
|
|
/**
|
|
* 表格表头配置项 TypeScript接口注释
|
|
* tableConfig<ConfigItem> = []
|
|
*
|
|
* Interface ConfigItem = {
|
|
* prop: string,
|
|
* label: string,
|
|
* width: string,
|
|
* align: string,
|
|
* subcomponent: function,
|
|
* filter: function
|
|
* }
|
|
*
|
|
*
|
|
*/
|
|
|
|
const tableBtn = [
|
|
{
|
|
type: 'edit',
|
|
btnName: 'btn.edit'
|
|
},
|
|
{
|
|
type: 'delete',
|
|
btnName: 'btn.delete'
|
|
}
|
|
]
|
|
const tableProps = [
|
|
// {
|
|
// prop: 'createTime',
|
|
// label: i18n.t('module.basicData.factory.createTime'),
|
|
// filter: timeFormatter
|
|
// },
|
|
{
|
|
prop: 'substrateId',
|
|
label: i18n.t('module.basicData.ScrapInfo.PlateId'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'workOrderName',
|
|
label: i18n.t('module.basicData.ScrapInfo.workOrderName'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'equipmentName',
|
|
label: i18n.t('module.basicData.ScrapInfo.name'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'registerPersonName',
|
|
label: i18n.t('module.basicData.ScrapInfo.RegisterPerson'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'updateTime',
|
|
label: i18n.t('module.basicData.ScrapInfo.updateTime'),
|
|
filter: timeFormatter,
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'placeOfRegis',
|
|
label: i18n.t('module.basicData.ScrapInfo.registrationPlace'),
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'scrapReason',
|
|
label: i18n.t('module.basicData.ScrapInfo.cause'),
|
|
align: 'center'
|
|
}
|
|
// {
|
|
// prop: 'scrapReasonId',
|
|
// label: i18n.t('module.basicData.ScrapInfo.cause'),
|
|
// subcomponent: ScrapInfoCause,
|
|
// align: 'center'
|
|
// // filter: scrapReasonList
|
|
// }
|
|
]
|
|
|
|
export default {
|
|
name: 'ScrapInfo',
|
|
components: { Pagination, BaseTable, MethodBtn, ScrapInfoAdd },
|
|
data() {
|
|
return {
|
|
addOrUpdateVisible: false,
|
|
tableBtn,
|
|
trueWidth: 200,
|
|
tableProps,
|
|
list: [],
|
|
total: 0,
|
|
listLoading: true,
|
|
formData: {
|
|
timeSlot: null,
|
|
substrateId: '',
|
|
orderId: '',
|
|
equipmentId: '',
|
|
current: 1,
|
|
size: 10,
|
|
id: ''
|
|
},
|
|
listQuery: {
|
|
current: 1,
|
|
size: 10
|
|
},
|
|
dict: {
|
|
scrap: []
|
|
},
|
|
orderList: [],
|
|
device: []
|
|
}
|
|
},
|
|
created() {
|
|
this.getDict()
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
handleClick(raw) {
|
|
if (raw.type === 'delete') {
|
|
this.$confirm(i18n.t('deleteMsgBox.content'), i18n.t('deleteMsgBox.hint'), {
|
|
confirmButtonText: i18n.t('btn.confirm'),
|
|
cancelButtonText: i18n.t('btn.cancel'),
|
|
type: 'warning'
|
|
}).then(() => {
|
|
delScrapInfo({ id: raw.data.id }).then(response => {
|
|
this.$message({
|
|
message: this.$t('module.basicData.visual.success'),
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.getList()
|
|
}
|
|
})
|
|
})
|
|
}).catch(() => {})
|
|
} else {
|
|
this.addNew(raw.data.id)
|
|
}
|
|
},
|
|
getList() {
|
|
this.listLoading = true
|
|
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 = ''
|
|
}
|
|
getScrapList(this.formData).then(response => {
|
|
if (response.data.records) {
|
|
this.list = response.data.records
|
|
console.log(this.list)
|
|
} else {
|
|
this.list.splice(0, this.list.length)
|
|
}
|
|
this.total = response.data.total
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
async getDict() {
|
|
const result1 = await getEqList({
|
|
current: 1,
|
|
size: 999
|
|
})
|
|
if (result1.code === 0) {
|
|
this.device = result1.data.records
|
|
}
|
|
const result2 = await ExecutionInfoList({
|
|
current: 1,
|
|
size: 999
|
|
})
|
|
if (result2.code === 0) {
|
|
this.orderList = result2.data.records
|
|
}
|
|
const result = await scrapReasonList()
|
|
this.dict.scrap = result
|
|
},
|
|
// 新增 / 修改
|
|
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>
|