259 lines
6.8 KiB
Vue
259 lines
6.8 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2023-08-01 14:55:51
|
|
* @LastEditors: zhp
|
|
* @LastEditTime: 2024-03-21 15:14:04
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
|
<base-table :max-height="tableH" :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
|
|
:table-data="list">
|
|
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="120" label="操作" :method-list="tableBtn"
|
|
@clickBtn="handleClick" /> -->
|
|
</base-table>
|
|
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="listQuery.total"
|
|
@pagination="getList" />
|
|
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// import AddOrUpdate from './add-or-updata';
|
|
// import unitDict from './unitDict';
|
|
// import basicPage from '../mixins/basic-page';
|
|
import { parseTime } from '../mixins/code-filter';
|
|
import {
|
|
getMaterialUseLogPage,
|
|
getWorkOrderList,
|
|
exportEnergyPlcExcel
|
|
} from '@/api/quality/materialTraceability';
|
|
|
|
const tableProps = [
|
|
{
|
|
prop: 'materialName',
|
|
label: '物料名称'
|
|
},
|
|
{
|
|
prop: 'materialCode',
|
|
label: '物料编码'
|
|
},
|
|
{
|
|
prop: 'dateName',
|
|
label: '物料批次'
|
|
},
|
|
{
|
|
prop: 'equipName',
|
|
label: '使用设备'
|
|
},
|
|
{
|
|
prop: 'num',
|
|
label: '使用数量'
|
|
},
|
|
{
|
|
prop: 'useTime',
|
|
label: '使用时间',
|
|
filter: parseTime
|
|
},
|
|
{
|
|
prop: 'userName',
|
|
label: '操作人',
|
|
showOverflowtooltip: true
|
|
},
|
|
{
|
|
prop: 'source',
|
|
label: '数据来源',
|
|
filter: (val) => val == 1 ? '内部' : '外部'
|
|
},
|
|
{
|
|
prop: 'remark',
|
|
label: '备注'
|
|
}
|
|
];
|
|
|
|
export default {
|
|
// mixins: [basicPage],
|
|
data() {
|
|
return {
|
|
// urlOptions: {
|
|
// getDataListURL: getMaterialUseLogPage,
|
|
// // deleteURL: deletePackingType,
|
|
// // exportURL: exportPackingExcel,
|
|
// },
|
|
tableProps,
|
|
tableH: this.tableHeight(260),
|
|
tableBtn: [
|
|
this.$auth.hasPermi(`base:packaging-print-log:update`)
|
|
? {
|
|
type: 'edit',
|
|
btnName: '编辑',
|
|
}
|
|
: undefined,
|
|
this.$auth.hasPermi(`base:packaging-print-log:delete`)
|
|
? {
|
|
type: 'delete',
|
|
btnName: '删除',
|
|
}
|
|
: undefined,
|
|
|
|
].filter((v) => v),
|
|
list: [],
|
|
listQuery: {
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
total: 0,
|
|
workOrderId: undefined,
|
|
startTime: undefined,
|
|
endTime:undefined,
|
|
},
|
|
formConfig: [
|
|
{
|
|
type: 'select',
|
|
label: '工单',
|
|
selectOptions: [],
|
|
labelField: 'name',
|
|
valueField: 'id',
|
|
param: 'workOrderId'
|
|
},
|
|
{
|
|
type: 'datePicker',
|
|
label: '时间段',
|
|
dateType: 'daterange',
|
|
format: 'yyyy-MM-dd',
|
|
valueFormat: "yyyy-MM-dd",
|
|
rangeSeparator: '-',
|
|
startPlaceholder: '开始时间',
|
|
endPlaceholder: '结束时间',
|
|
param: 'timeVal',
|
|
defaultSelect: [],
|
|
width: 250
|
|
},
|
|
{
|
|
type: 'button',
|
|
btnName: '查询',
|
|
name: 'search',
|
|
color: 'primary',
|
|
},
|
|
{
|
|
type: 'separate',
|
|
},
|
|
// {
|
|
// type: 'separate',
|
|
// },
|
|
// {
|
|
// type: 'button',
|
|
// btnName: '重置',
|
|
// name: 'reset',
|
|
// },
|
|
// {
|
|
// type: 'separate',
|
|
// },
|
|
// {
|
|
// type: this.$auth.hasPermi('base:packaging-print-log:create') ? 'button' : '',
|
|
// btnName: '新增',
|
|
// name: 'add',
|
|
// color: 'success',
|
|
// plain: true,
|
|
// },
|
|
// {
|
|
// type: 'separate',
|
|
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
|
|
// },
|
|
{
|
|
type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
|
|
btnName: '导出',
|
|
name: 'export',
|
|
color: 'primary',
|
|
plain: true
|
|
},
|
|
],
|
|
};
|
|
},
|
|
components: {
|
|
// AddOrUpdate,
|
|
},
|
|
created() {
|
|
window.addEventListener('resize', () => {
|
|
this.tableH = this.tableHeight(260)
|
|
})
|
|
this.getList()
|
|
this.getDict()
|
|
},
|
|
methods: {
|
|
getList() {
|
|
getMaterialUseLogPage({ ...this.listQuery }).then(res => {
|
|
this.list = res.data || []
|
|
this.listQuery.total = res.data.total || 0
|
|
})
|
|
},
|
|
getDict() {
|
|
// 获取产品的属性列表
|
|
// getCustomerList().then((response) => {
|
|
// console.log(response);
|
|
// this.customerList = response.data
|
|
// // this.listQuery.total = response.data.total;
|
|
// })
|
|
// getModelList().then((response) => {
|
|
// console.log(response);
|
|
// this.modelList = response.data
|
|
// // this.listQuery.total = response.data.total;
|
|
// })
|
|
getWorkOrderList().then((response) => {
|
|
// console.log(response);
|
|
this.formConfig[0].selectOptions = response.data.map((item) => {
|
|
return {
|
|
name: item.name,
|
|
id: item.id
|
|
}
|
|
})
|
|
console.log(this.formConfig[0].selectOptions);
|
|
// this.listQuery.total = response.data.total;
|
|
})
|
|
},
|
|
handleExport() {
|
|
// 处理查询参数
|
|
let params = { ...this.listQuery };
|
|
params.pageNo = undefined;
|
|
params.pageSize = undefined;
|
|
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
|
|
this.exportLoading = true;
|
|
return exportEnergyPlcExcel(params);
|
|
}).then(response => {
|
|
this.$download.excel(response, '物料信息追溯 ');
|
|
this.exportLoading = false;
|
|
}).catch(() => { });
|
|
},
|
|
buttonClick(val) {
|
|
console.log(val)
|
|
if (val.btnName === 'search') {
|
|
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
|
|
// this.queryParams.status = val.status
|
|
if (val.timeVal && val.timeVal.length != 0 ) {
|
|
this.listQuery.startTime = val.timeVal[0] + ' 00:00:00'
|
|
this.listQuery.endTime = val.timeVal[1] + ' 23:59:59'
|
|
} else {
|
|
this.listQuery.startTime = undefined
|
|
this.listQuery.endTime = undefined
|
|
}
|
|
this.getList()
|
|
} else {
|
|
this.handleExport()
|
|
// this.addOrEditTitle = '新增'
|
|
// this.centervisible = true
|
|
// this.$nextTick(() => {
|
|
// this.$refs.orderAdd.init()
|
|
// })
|
|
}
|
|
},
|
|
otherMethods(val) {
|
|
this.addOrUpdateVisible = true;
|
|
this.addOrEditTitle = '详情';
|
|
this.$nextTick(() => {
|
|
this.$refs.addOrUpdate.init(val.data.id, true);
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|