280 lines
7.6 KiB
Vue
280 lines
7.6 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2023-08-01 14:55:51
|
|
* @LastEditors: zhp
|
|
* @LastEditTime: 2023-11-28 10:51:44
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
|
|
<base-table :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 {
|
|
getProcessTraceabilityPage,
|
|
getWorkOrderList,
|
|
getCoreProduct
|
|
// exportEnergyPlcExcel
|
|
} from '@/api/quality/processTraceability';
|
|
import { publicFormatter } from '@/utils/dict';
|
|
const tableProps = [
|
|
{
|
|
prop: 'name',
|
|
label: '工单名称'
|
|
},
|
|
{
|
|
prop: 'code',
|
|
label: '工单编码'
|
|
},
|
|
{
|
|
prop: 'planProductName',
|
|
label: '产品名'
|
|
},
|
|
{
|
|
prop: 'status',
|
|
label: '状态',
|
|
filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废',
|
|
},
|
|
{
|
|
prop: 'startProduceTime',
|
|
label: '开始生产时间',
|
|
filter: parseTime
|
|
},
|
|
{
|
|
prop: 'finishProduceTime',
|
|
label: '结束生产时间',
|
|
filter: parseTime
|
|
},
|
|
{
|
|
prop: 'actualQuantity',
|
|
label: '生产数量'
|
|
},
|
|
{
|
|
prop: 'planProductUnit',
|
|
label: '单位',
|
|
filter: publicFormatter('unit_dict')
|
|
},
|
|
{
|
|
prop: 'processFlowName',
|
|
label: '工艺名称'
|
|
},
|
|
{
|
|
prop: 'yield',
|
|
label: '合格率'
|
|
}
|
|
];
|
|
|
|
export default {
|
|
// mixins: [basicPage],
|
|
data() {
|
|
return {
|
|
// urlOptions: {
|
|
// getDataListURL: getMaterialUseLogPage,
|
|
// // deleteURL: deletePackingType,
|
|
// // exportURL: exportPackingExcel,
|
|
// },
|
|
tableProps,
|
|
tableBtn: [
|
|
// this.$auth.hasPermi(`base:packaging-print-log:update`)
|
|
// ? {
|
|
// type: 'edit',
|
|
// btnName: '编辑',
|
|
// }
|
|
// : undefined,
|
|
{
|
|
type: 'processDetail',
|
|
btnName: '查看工艺详情',
|
|
},
|
|
|
|
].filter((v) => v),
|
|
list: [],
|
|
listQuery: {
|
|
pageSize: 10,
|
|
pageNo: 1,
|
|
// total: 0,
|
|
// orderName: '工单',
|
|
// startTime: undefined,
|
|
// endTime:undefined,
|
|
},
|
|
formConfig: [
|
|
{
|
|
type: 'select',
|
|
label: '工单',
|
|
selectOptions: [],
|
|
labelField: 'name',
|
|
valueField: 'id',
|
|
param: 'orderName',
|
|
filterable: true,
|
|
},
|
|
{
|
|
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: '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: 'warning',
|
|
// },
|
|
],
|
|
};
|
|
},
|
|
components: {
|
|
// AddOrUpdate,
|
|
},
|
|
created() {
|
|
this.getList()
|
|
this.getDict()
|
|
},
|
|
methods: {
|
|
getList() {
|
|
getProcessTraceabilityPage(this.listQuery).then(res => {
|
|
this.list = res.data.list || []
|
|
this.listQuery.total = res.data.total || 0
|
|
})
|
|
},
|
|
handleClick(val) {
|
|
if (val.type === "processDetail") {
|
|
console.log(val);
|
|
let specificationsData =''
|
|
getCoreProduct(val.data.planProductId).then((res) => {
|
|
console.log(res)
|
|
|
|
this.$router.push({
|
|
path: 'process-traceability-detail',
|
|
query: {
|
|
id: val.data.processFlowId,
|
|
orderId: val.data.id,
|
|
name: val.data.name,
|
|
specifications: res.data.specifications,
|
|
productName: val.data.planProductName,
|
|
processFlowName: val.data.processFlowName,
|
|
// planProductId: val.data.planProductId
|
|
// equipmentName,
|
|
},
|
|
});
|
|
})
|
|
|
|
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
|
|
}
|
|
},
|
|
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.name
|
|
}
|
|
})
|
|
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.orderName = val.orderName ? val.orderName :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>
|