This commit is contained in:
朱菊兰 2024-07-18 11:17:04 +08:00
parent 0f70fe85c8
commit f043a6a0a2
10 changed files with 1727 additions and 1923 deletions

View File

@ -7,23 +7,39 @@
<template>
<div style="flex: 1; display: flex; background: #f2f4f9">
<div class="app-container" style="
<div
class="app-container"
style="
margin-right: 12px;
border-radius: 8px;
background: #fff;
padding: 0;
">
<div class="factory-list__selector" style="margin: 12px" title="点击切换工厂" @mouseenter="factoryListOpen = true"
<div
class="factory-list__selector"
style="margin: 12px"
title="点击切换工厂"
@mouseenter="factoryListOpen = true"
@mouseleave="factoryListOpen = false">
{{ currentFactory?.label || '点我选择设备' }}
<div class="factory-list__wrapper" :class="{ open: factoryListOpen }">
<ul class="factory-list" v-if="sidebarContent.length" @click.prevent="factoryChangeHandler">
<li v-for="fc in sidebarContent" :key="fc.id" :data-value="fc.id" class="factory-list__item"
<ul
class="factory-list"
v-if="sidebarContent.length"
@click.prevent="factoryChangeHandler">
<li
v-for="fc in sidebarContent"
:key="fc.id"
:data-value="fc.id"
class="factory-list__item"
:class="{ 'is-current': fc.id == currentFactory?.id }">
<span>
{{ fc.label }}
</span>
<svg-icon v-if="fc.id == currentFactory?.id" icon-class="Confirm" style="height: 14px; width: 14px" />
<svg-icon
v-if="fc.id == currentFactory?.id"
icon-class="Confirm"
style="height: 14px; width: 14px" />
</li>
</ul>
<div v-else style="color: #0008; width: 128px; text-align: center">
@ -33,8 +49,13 @@
</div>
<!-- side bar -->
<div class="side-bar__left" style="width: 240px; height: 100%">
<el-tree class="custom-tree-class" :data="currentFactory?.children" :props="treeProps" :empty-text="''"
icon-class="custom-icon-class" @node-click="handleSidebarItemClick">
<el-tree
class="custom-tree-class"
:data="currentFactory?.children"
:props="treeProps"
:empty-text="''"
icon-class="custom-icon-class"
@node-click="handleSidebarItemClick">
<!-- <div class="custom-tree-node" slot-scope="{ node, data }">
<span class="icon"></span>
<span>{{ node.label }}</span>
@ -42,30 +63,46 @@
</el-tree>
</div>
</div>
<div class="app-container equipment-process-amount" style="flex: 1; border-radius: 8px; background: #fff">
<div
class="app-container equipment-process-amount"
style="flex: 1; border-radius: 8px; background: #fff">
<!-- main area -->
<div class="main-content" style="display: flex; flex-direction: column">
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick"
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick"
@select-changed="handleSearchBarChanged" />
<el-row>
<el-col class="custom-tabs">
<div v-if="tableList.length" class="tables">
<div class="custom-table" v-for="table in tableList" :key="table.key">
<div
class="custom-table"
v-for="table in tableList"
:key="table.key">
<!-- {{ JSON.stringify(spanMethod) }} -->
<base-table :key="table.key + '__basetable'" :table-props="table.tableProps"
:table-data="table.dataManager?.dataList ?? []" :span-method="spanMethod"
<base-table
:key="table.key + '__basetable'"
:table-props="table.tableProps"
:table-data="table.dataManager?.dataList ?? []"
:span-method="spanMethod"
@emitFun="(val) => handleEmitFun(table, val)"></base-table>
<pagination :key="table.key + '__pagination'" v-show="table.total > 0" :total="table.total"
:page.sync="table.pageNo" :limit.sync="table.pageSize" :page-size="table.pageSize"
:page-sizes="[1, 3, 5, 10, 20]" @pagination="
<pagination
:key="table.key + '__pagination'"
v-show="table.total > 0"
:total="table.total"
:page.sync="table.pageNo"
:limit.sync="table.pageSize"
:page-size="table.pageSize"
:page-sizes="[1, 3, 5, 10, 20]"
@pagination="
({ page, limit, current }) =>
getListFor(table, { page, limit, current })
" />
</div>
</div>
<div v-else class="no-data-bg">
</div>
<div v-else class="no-data-bg"></div>
</el-col>
</el-row>
@ -77,10 +114,7 @@
<script>
// import Graph from './graph.vue';
import {
getWorkOrderList,
getTreeData
} from '@/api/quality/deviceParameters';
import { getWorkOrderList, getTreeData } from '@/api/quality/deviceParameters';
export default {
name: 'EquipmentProcessAmount',
// components: { Graph },
@ -203,6 +237,7 @@ export default {
valueField: 'id',
param: 'workOrderId',
onchange: true,
filterable: true,
},
{
type: 'datePicker',
@ -223,9 +258,9 @@ export default {
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
{
type: 'separate',
},
// {
// type: 'button',
// btnName: '',
@ -240,12 +275,15 @@ export default {
// plain: true,
// color: 'warning',
// },
// {
// type: this.$auth.hasPermi('base:equipment-group:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
{
type: this.$auth.hasPermi('base:equipment-group:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
plain: true,
color: 'success',
},
],
tableProps: [
{ prop: 'lineName', label: '产线' },
@ -286,7 +324,7 @@ export default {
// },
},
mounted() {
this.getDict()
this.getDict();
// if (this.id) this.$set(this.queryParams, 'id', this.id);
// if (this.code)
// this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code);
@ -303,7 +341,7 @@ export default {
}
switch (param) {
case 'workOrderId':
this.getTree(value)
this.getTree(value);
break;
}
},
@ -325,12 +363,12 @@ export default {
this.searchBarFormConfig[0].selectOptions = res.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
id: item.id,
};
});
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
});
},
buildProps(table) {
console.log('building props', table);
@ -365,7 +403,8 @@ export default {
prop: item.name,
width: 128,
});
firstLineData[item.name] = `${item.minValue ?? ''}-${item.maxValue ?? ''
firstLineData[item.name] = `${item.minValue ?? ''}-${
item.maxValue ?? ''
}${item.defaultValue != null ? '/' + item.defaultValue : ''}`;
});
return { props, firstLineData };
@ -486,17 +525,16 @@ export default {
},
async getTree(id) {
getTreeData({id:id}).then((res) => {
getTreeData({ id: id }).then((res) => {
console.log(res.data);
this.sidebarContent = res.data;
this.buildTree(res.data);
console.log('tree', this.sidebarContent);
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
});
// const { data } = await this.$axios('/base/core-factory/getTreeByWorkOrder');
// console.log(data)
},
handleTabClick(tab, event) {
@ -511,7 +549,7 @@ export default {
},
handleSidebarItemClick({ label, id, type }) {
this.equipmentId = id
this.equipmentId = id;
console.log('label clicked!', label, id, type);
switch (type) {
case '设备':
@ -534,13 +572,13 @@ export default {
}
},
handleEmitFun() { },
handleEmitFun() {},
},
};
</script>
<style scoped>
.side-bar__left>>>.is-current {
.side-bar__left >>> .is-current {
padding: 0;
color: #111;
/* background: #f2f4f7; */
@ -565,13 +603,13 @@ export default {
transform: translateY(0);
}
.custom-tabs>>>.el-tabs__header {
.custom-tabs >>> .el-tabs__header {
margin-bottom: 8px;
display: inline-block;
transform: translateY(-12px);
}
.custom-tabs>>>.el-tabs__item {
.custom-tabs >>> .el-tabs__item {
padding-left: 0px !important;
padding-right: 0px !important;
line-height: 36px !important;
@ -673,21 +711,24 @@ li {
font-weight: bold;
} */
.custom-tree-class>>>.el-tree-node__content {
.custom-tree-class >>> .el-tree-node__content {
width: 100%;
height: auto !important;
padding: 8px 12px !important;
}
.custom-tree-class>>>.el-tree-node__content:hover {
.custom-tree-class >>> .el-tree-node__content:hover {
background: #e3efff;
}
.custom-tree-class>>>.el-tree-node__children .el-tree-node__content {
.custom-tree-class >>> .el-tree-node__children .el-tree-node__content {
padding: 8px 18px !important;
}
.custom-tree-class>>>.el-tree-node__children .el-tree-node__children .el-tree-node__content {
.custom-tree-class
>>> .el-tree-node__children
.el-tree-node__children
.el-tree-node__content {
padding: 8px 24px !important;
}
</style>
@ -697,7 +738,8 @@ li {
margin-right: 8px;
width: 20px;
height: 20px;
background: url('../../../../assets/images/Qian.png') center center / contain no-repeat;
background: url('../../../../assets/images/Qian.png') center center / contain
no-repeat;
}
.custom-icon-class.el-tree-node__expand-icon.expanded {
@ -705,7 +747,8 @@ li {
}
.el-tree-node__children .custom-icon-class {
background: url('../../../../assets/images/tree-icon-2.png') 100% / contain no-repeat;
background: url('../../../../assets/images/tree-icon-2.png') 100% / contain
no-repeat;
}
.el-tree-node__children .el-tree-node__children .custom-icon-class {

View File

@ -186,16 +186,16 @@ export default {
},
],
},
{
prop: 'oee',
label: 'OEE',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
{
prop: 'teep',
label: 'TEEP',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
},
// {
// prop: 'oee',
// label: 'OEE',
// filter: (val) => (val != null ? +val.toFixed(3) : '-'),
// },
// {
// prop: 'teep',
// label: 'TEEP',
// filter: (val) => (val != null ? +val.toFixed(3) : '-'),
// },
// {
// _action: 'view-trend',
// label: '',
@ -232,6 +232,7 @@ export default {
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
filterable: true,
},
// {
// type: 'select',
@ -256,7 +257,7 @@ export default {
// parent: 'dateFilterType',
//
type: 'datePicker',
// label: '',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
@ -285,16 +286,16 @@ export default {
name: 'search',
color: 'primary',
},
// {
// type: 'separate',
// },
// {
// type: 'button',
// btnName: '',
// name: 'visualization',
// plain: true,
// color: 'success',
// },
{
type: 'separate',
},
{
type: 'button',
btnName: '导出',
name: 'export',
plain: true,
color: 'success',
},
// {
// type: 'button',
// btnName: 'OEE',
@ -324,7 +325,7 @@ export default {
};
},
created() {
this.getWorkOrder()
this.getWorkOrder();
// this.getLine();
this.getList();
},

View File

@ -7,12 +7,22 @@
-->
<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">
<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
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
@ -26,48 +36,48 @@ import { parseTime } from '../mixins/code-filter';
import {
getMaterialUseLogPage,
getWorkOrderList,
exportEnergyPlcExcel
exportEnergyPlcExcel,
} from '@/api/quality/materialTraceability';
const tableProps = [
{
prop: 'materialName',
label: '物料名称'
label: '物料名称',
},
{
prop: 'materialCode',
label: '物料编码'
label: '物料编码',
},
{
prop: 'dateName',
label: '物料批次'
label: '物料批次',
},
{
prop: 'equipName',
label: '使用设备'
label: '使用设备',
},
{
prop: 'num',
label: '使用数量'
label: '使用数量',
},
{
prop: 'useTime',
label: '使用时间',
filter: parseTime
filter: parseTime,
},
{
prop: 'userName',
label: '操作人'
label: '操作人',
},
{
prop: 'source',
label: '数据来源',
filter: (val) => val == 1 ? '内部' : '外部'
filter: (val) => (val == 1 ? '内部' : '外部'),
},
{
prop: 'remark',
label: '备注'
}
label: '备注',
},
];
export default {
@ -93,7 +103,6 @@ export default {
btnName: '删除',
}
: undefined,
].filter((v) => v),
list: [],
listQuery: {
@ -102,7 +111,7 @@ export default {
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime:undefined,
endTime: undefined,
},
formConfig: [
{
@ -111,24 +120,24 @@ export default {
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId'
param: 'workOrderId',
},
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "yyyy-MM-dd",
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 250
width: 250,
},
{
type: 'button',
btnName: '搜索',
btnName: '查询',
name: 'search',
color: 'primary',
},
@ -158,10 +167,13 @@ export default {
// type: this.$auth.hasPermi('base:product:create') ? 'separate' : '',
// },
{
type: this.$auth.hasPermi('monitoring:materiel-date-from:export') ? 'button' : '',
type: this.$auth.hasPermi('monitoring:materiel-date-from:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
color: 'warning',
plain: true,
color: 'success',
},
],
};
@ -170,15 +182,15 @@ export default {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
this.getList();
this.getDict();
},
methods: {
getList() {
getMaterialUseLogPage({ ...this.listQuery }).then(res => {
this.list = res.data || []
this.listQuery.total = res.data.total || 0
})
getMaterialUseLogPage({ ...this.listQuery }).then((res) => {
this.list = res.data || [];
this.listQuery.total = res.data.total || 0;
});
},
getDict() {
//
@ -197,41 +209,47 @@ export default {
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
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.$modal
.confirm('是否确认导出所有数据项?')
.then(() => {
this.exportLoading = true;
return exportEnergyPlcExcel(params);
}).then(response => {
})
.then((response) => {
this.$download.excel(response, '物料信息追溯 ');
this.exportLoading = false;
}).catch(() => { });
})
.catch(() => {});
},
buttonClick(val) {
console.log(val)
console.log(val);
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
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'
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.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
this.getList()
this.getList();
} else {
this.handleExport()
this.handleExport();
// this.addOrEditTitle = ''
// this.centervisible = true
// this.$nextTick(() => {

View File

@ -7,12 +7,27 @@
-->
<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"
<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
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
@ -26,55 +41,64 @@ import { parseTime } from '../mixins/code-filter';
import {
getProcessTraceabilityPage,
getWorkOrderList,
getCoreProduct
getCoreProduct,
// exportEnergyPlcExcel
} from '@/api/quality/processTraceability';
import { publicFormatter } from '@/utils/dict';
const tableProps = [
{
prop: 'name',
label: '工单名称'
label: '工单名称',
},
{
prop: 'code',
label: '工单编码'
label: '工单编码',
},
{
prop: 'planProductName',
label: '产品名'
label: '产品名',
},
{
prop: 'status',
label: '状态',
filter: (val) => val == 1 ? '等待' : val == 2 ? '激活' : val == 3 ? '暂停' : val == 4 ? '完成' : '作废',
filter: (val) =>
val == 1
? '等待'
: val == 2
? '激活'
: val == 3
? '暂停'
: val == 4
? '完成'
: '作废',
},
{
prop: 'startProduceTime',
label: '开始生产时间',
filter: parseTime
filter: parseTime,
},
{
prop: 'finishProduceTime',
label: '结束生产时间',
filter: parseTime
filter: parseTime,
},
{
prop: 'actualQuantity',
label: '生产数量'
label: '生产数量',
},
{
prop: 'planProductUnit',
label: '单位',
filter: publicFormatter('unit_dict')
filter: publicFormatter('unit_dict'),
},
{
prop: 'processFlowName',
label: '工艺名称'
label: '工艺名称',
},
{
prop: 'yield',
label: '合格率'
}
label: '合格率',
},
];
export default {
@ -98,7 +122,6 @@ export default {
type: 'processDetail',
btnName: '查看工艺详情',
},
].filter((v) => v),
list: [],
listQuery: {
@ -112,7 +135,7 @@ export default {
formConfig: [
{
type: 'select',
label: '工单',
label: '工单名称',
selectOptions: [],
labelField: 'name',
valueField: 'id',
@ -124,17 +147,17 @@ export default {
label: '工单开始时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: "yyyy-MM-dd",
valueFormat: 'yyyy-MM-dd',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'timeVal',
defaultSelect: [],
width: 250
width: 250,
},
{
type: 'button',
btnName: '搜索',
btnName: '查询',
name: 'search',
color: 'primary',
},
@ -173,22 +196,22 @@ export default {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
this.getList();
this.getDict();
},
methods: {
getList() {
getProcessTraceabilityPage(this.listQuery).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
getProcessTraceabilityPage(this.listQuery).then((res) => {
this.list = res.data.list || [];
this.listQuery.total = res.data.total || 0;
});
},
handleClick(val) {
if (val.type === "processDetail") {
if (val.type === 'processDetail') {
console.log(val);
let specificationsData =''
let specificationsData = '';
getCoreProduct(val.data.planProductId).then((res) => {
console.log(res)
console.log(res);
this.$router.push({
path: 'process-traceability-detail',
@ -203,7 +226,7 @@ export default {
// equipmentName,
},
});
})
});
// this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex)
}
@ -225,12 +248,12 @@ export default {
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.name
}
})
id: item.name,
};
});
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
});
},
// handleExport() {
// //
@ -246,18 +269,18 @@ export default {
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
console.log(val);
if (val.btnName === 'search') {
this.listQuery.orderName = val.orderName ? val.orderName :undefined
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'
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.listQuery.startTime = undefined;
this.listQuery.endTime = undefined;
}
this.getList()
this.getList();
} else {
// this.handleExport()
// this.addOrEditTitle = ''

View File

@ -7,12 +7,22 @@
-->
<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">
<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
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getList" />
<!-- <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" /> -->
</div>
@ -34,35 +44,36 @@ const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime
filter: parseTime,
width: 150,
},
{
prop: 'material',
label: '原料名称',
filter: publicFormatter('material')
filter: publicFormatter('material'),
},
{
prop: 'origin',
label: '来源',
filter: (val)=>val == 1 ? '内部' : '外部'
filter: (val) => (val == 1 ? '内部' : '外部'),
},
{
prop: 'supplierId',
label: '供应商'
label: '供应商',
},
{
prop: 'batch',
label: '批次'
label: '批次',
},
{
prop: 'num',
label: '数量'
label: '数量',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
}
filter: publicFormatter('unit_dict'),
},
];
export default {
@ -88,7 +99,6 @@ export default {
btnName: '删除',
}
: undefined,
].filter((v) => v),
list: [],
listQuery: {
@ -97,7 +107,7 @@ export default {
total: 0,
workOrderId: undefined,
startTime: undefined,
endTime:undefined,
endTime: undefined,
},
formConfig: [
{
@ -106,7 +116,7 @@ export default {
selectOptions: [],
labelField: 'name',
valueField: 'id',
param: 'workOrderId'
param: 'workOrderId',
},
// {
// type: 'datePicker',
@ -162,15 +172,15 @@ export default {
// AddOrUpdate,
},
created() {
this.getList()
this.getDict()
this.getList();
this.getDict();
},
methods: {
getList() {
getRawMaterialPage({ ...this.listQuery }).then(res => {
this.list = res.data.list || []
this.listQuery.total = res.data.total || 0
})
getRawMaterialPage({ ...this.listQuery }).then((res) => {
this.list = res.data.records || [];
this.listQuery.total = res.data.total || 0;
});
},
getDict() {
//
@ -189,12 +199,12 @@ export default {
this.formConfig[0].selectOptions = response.data.map((item) => {
return {
name: item.name,
id: item.id
}
})
id: item.id,
};
});
console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
})
});
},
// handleExport() {
// //
@ -210,9 +220,11 @@ export default {
// }).catch(() => { });
// },
buttonClick(val) {
console.log(val)
console.log(val);
if (val.btnName === 'search') {
this.listQuery.workOrderId = val.workOrderId ? val.workOrderId :undefined
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'
@ -221,7 +233,7 @@ export default {
// this.listQuery.startTime = undefined
// this.listQuery.endTime = undefined
// }
this.getList()
this.getList();
} else {
// this.handleExport()
// this.addOrEditTitle = ''

View File

@ -6,68 +6,135 @@
-->
<template>
<el-form ref="form" :model="innerDataForm" label-width="100px" v-loading="formLoading">
<el-form
ref="form"
:model="innerDataForm"
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="工单名称" prop="workOrderId" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.workOrderId" placeholder="请选择工单名称" filterable clearable>
<el-option v-for="opt in workOrderList" :key="opt.value" :label="opt.label" :value="opt.value" />
<el-form-item
label="工单名称"
prop="workOrderId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.workOrderId"
placeholder="请选择工单名称"
filterable
clearable>
<el-option
v-for="opt in workOrderList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测内容" prop="inspectionDetId"
<el-form-item
label="检测内容"
prop="inspectionDetId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.inspectionDetId" placeholder="请选择检测内容" filterable clearable
<el-select
v-model="innerDataForm.inspectionDetId"
placeholder="请选择检测内容"
filterable
clearable
@change="handleInspectionDetChange">
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
<el-option
v-for="opt in inspectionDetList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="productionLineId"
<el-form-item
label="产线"
prop="productionLineId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.productionLineId" placeholder="请选择产线" filterable clearable
<el-select
v-model="innerDataForm.productionLineId"
placeholder="请选择产线"
filterable
clearable
@change="handleProductlineChange">
<el-option v-for="opt in productionLineList" :key="opt.value" :label="opt.label" :value="opt.value" />
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工段" prop="sectionId" :rules="[{ required: false, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.sectionId" placeholder="请选择工段" clearable filterable
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: false, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.sectionId"
placeholder="请选择工段"
clearable
filterable
@change="$emit('update', innerDataForm)">
<el-option v-for="opt in sectionList" :key="opt.value" :label="opt.label" :value="opt.value" />
<el-option
v-for="opt in sectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="检测人员" prop="checkPerson">
<el-input v-model="innerDataForm.checkPerson" clearable @change="$emit('update', innerDataForm)"
placeholder="请输入检测人员" />
<el-form-item label="检测人" prop="checkPerson">
<el-input
v-model="innerDataForm.checkPerson"
clearable
@change="$emit('update', innerDataForm)"
placeholder="请输入检测人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测时间" prop="checkTime" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker v-model="innerDataForm.checkTime" type="datetime" placeholder="请选择检测时间"
value-format="timestamp" @change="$emit('update', innerDataForm)"></el-date-picker>
<el-form-item
label="检测时间"
prop="checkTime"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="innerDataForm.checkTime"
type="datetime"
placeholder="请选择检测时间"
value-format="timestamp"
@change="$emit('update', innerDataForm)"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="来源" prop="source" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select v-model="innerDataForm.source" placeholder="请选择来源" filterable clearable
<el-form-item
label="来源"
prop="source"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="innerDataForm.source"
placeholder="请选择来源"
filterable
clearable
@change="$emit('update', innerDataForm)">
<el-option v-for="opt in [
<el-option
v-for="opt in [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
]" :key="opt.value" :label="opt.label" :value="opt.value" />
]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
@ -75,8 +142,10 @@
<el-row :gutter="20">
<el-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="innerDataForm.remark" @change="$emit('update', innerDataForm)" placeholder="请输入备注">
</el-input>
<el-input
v-model="innerDataForm.remark"
@change="$emit('update', innerDataForm)"
placeholder="请输入备注"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -104,17 +173,19 @@ export default {
inspectionDetList: [],
productionLineList: [],
sectionList: [],
workOrderList:[],
workOrderList: [],
innerDataForm: {},
cacheInspectionDetList: null,
};
},
mounted() {
Promise.all([this.getProductLineList(), this.getInspectionDetList(), this.getWorkOrderList()]).then(
() => {
Promise.all([
this.getProductLineList(),
this.getInspectionDetList(),
this.getWorkOrderList(),
]).then(() => {
this.formLoading = false;
}
);
});
},
watch: {
// 'innerDataForm.productionLineId': {

View File

@ -17,7 +17,7 @@
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:width="80"
fixed="right"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
@ -66,78 +66,6 @@ export default {
mixins: [basicPageMixin],
data() {
return {
rows: [
[
{
select: true,
label: '检测内容',
url: '/base/quality-inspection-det/listAll',
prop: 'inspectionDetId',
labelKey: 'content',
rules: [{ required: true, message: '检测内容不能为空', trigger: 'blur' }],
bind: {
filterable: true,
},
},
{
select: true,
label: '来源',
prop: 'source',
value: 1, //
options: [
{ label: '手动', value: 1 },
{ label: '自动', value: 2 },
],
bind: {
filterable: true,
},
},
],
[
{
select: true,
label: '产线',
url: '/base/production-line/listAll',
prop: 'productionLineId',
bind: {
filterable: true,
},
rules: [{ required: true, message: '产线不能为空', trigger: 'blur' }],
},
{
select: true,
label: '工段',
url: '/base/workshop-section/listAll', // url options
options: [], // options, options
prop: 'sectionId',
bind: {
filterable: true,
},
rules: [{ required: false, message: '不能为空', trigger: 'blur' }],
},
],
[
{
input: true,
label: '检测人员',
prop: 'checkPerson',
},
{
datetime: true,
label: '检测时间',
prop: 'checkTime',
rules: [{ required: true, message: '检测时间不能为空', trigger: 'blur' }],
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
],
[{ textarea: true, label: '描述', prop: 'explainText' }],
[{ input: true, label: '备注', prop: 'remark' }],
],
searchBarFormConfig: [
{
type: 'select',
@ -145,7 +73,7 @@ export default {
placeholder: '请选择工单名称',
param: 'workOrderId',
selectOptions: [],
filterable:true
filterable: true,
},
{
type: 'select',
@ -153,7 +81,7 @@ export default {
placeholder: '请输入检测内容',
selectOptions: [],
param: 'inspectionDetContent',
filterable: true
filterable: true,
},
{
type: 'datePicker',
@ -179,9 +107,7 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi(
'base:quality-inspection-record:create'
)
type: this.$auth.hasPermi('base:quality-inspection-record:create')
? 'button'
: '',
btnName: '新增',
@ -224,7 +150,7 @@ export default {
},
{
// width: 128,
prop: 'lineName',
prop: 'productionLineName',
label: '产线',
},
{
@ -247,7 +173,7 @@ export default {
},
],
// keys, queryParams pageNo, pageSize key
searchBarKeys: ['inspectionDetContent', 'checkTime', 'productionLineId'],
searchBarKeys: ['workOrderId', 'inspectionDetContent', 'checkTime'],
form: {
id: undefined,
inspectionDetId: undefined,
@ -255,17 +181,17 @@ export default {
productionLineId: undefined,
sectionId: undefined,
checkPerson: undefined,
workOrderId:undefined,
workOrderId: undefined,
checkTime: undefined,
source: undefined,
explainText: undefined,
workOrderId: undefined,
remark: undefined,
},
//
queryParams: {
pageNo: 1,
pageSize: 10,
workOrderId:null,
workOrderId: null,
inspectionDetContent: null,
checkTime: [],
// productionLineId: null,
@ -274,38 +200,15 @@ export default {
},
created() {
this.getList();
this.getProductLineList()
this.getProductLineList();
},
watch: {
form: {
handler: function (val) {
console.log('form change:', val);
},
deep: true
}
// 线
// 'form.productionLineId': {
// handler: function (val) {
// if (val == null) return;
// this.$axios('/base/workshop-section/listByParentId', {
// params: {
// id: val,
// },
// }).then((response) => {
// this.$set(
// this.rows[1][1], // this.rows
// 'options',
// response.data.map((item) => {
// return {
// label: item.name,
// value: item.id,
// };
// })
// );
// });
// },
// immediate: true,
// },
deep: true,
},
},
methods: {
/** 获取搜索栏的产线列表 */
@ -319,7 +222,7 @@ export default {
};
}
);
})
});
this.$axios('/base/quality-inspection-det/listAll').then((response) => {
this.searchBarFormConfig[1].selectOptions = response.data.map(
(item) => {
@ -356,7 +259,7 @@ export default {
checkPerson: undefined,
checkTime: undefined,
source: undefined,
explainText: undefined,
workOrderId: undefined,
remark: undefined,
productionLineId: undefined,
};
@ -376,7 +279,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = '添加质量检查信息记录表';
this.title = '新增';
},
/** 修改按钮操作 */
handleUpdate(row) {
@ -384,13 +287,13 @@ export default {
const id = row.id;
getQualityInspectionRecord(id).then((response) => {
/** 因为后端返回的时间是时间戳格式,需转换 */
const info = {}
Object.keys(this.form).forEach(key => {
info[key] = response.data[key]
const info = {};
Object.keys(this.form).forEach((key) => {
info[key] = response.data[key];
});
this.form = info;
this.open = true;
this.title = '修改质量检查信息记录表';
this.title = '编辑';
});
},
/** 提交按钮 */

View File

@ -1,10 +1,3 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-21 14:11:18
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form
:model="dataForm"
@ -18,7 +11,8 @@
<el-select
v-model="dataForm.workOrderId"
placeholder="请选择工单号"
style="width: 100%">
style="width: 100%"
:disabled="showDetail">
<el-option
v-for="dict in workOrderList"
:key="dict.id"
@ -28,11 +22,12 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组" prop="teamId">
<el-form-item label="班组" prop="teamId" :disabled="showDetail">
<el-select
v-model="dataForm.teamId"
placeholder="请选择班组"
style="width: 100%">
style="width: 100%"
:disabled="showDetail">
<el-option
v-for="dict in teamList"
:key="dict.id"
@ -43,7 +38,10 @@
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num" style="width: 100%">
<el-input v-model="dataForm.num" placeholder="请输入数量" />
<el-input
v-model="dataForm.num"
placeholder="请输入数量"
:disabled="showDetail" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -51,7 +49,8 @@
<el-select
v-model="dataForm.lineId"
placeholder="请选择产线"
style="width: 100%">
style="width: 100%"
:disabled="showDetail">
<el-option
v-for="dict in lineList"
:key="dict.id"
@ -65,7 +64,8 @@
<el-select
v-model="dataForm.detId"
placeholder="请选择报废原因"
style="width: 100%">
style="width: 100%"
:disabled="showDetail">
<el-option
v-for="dict in detList"
:key="dict.id"
@ -79,9 +79,11 @@
<el-date-picker
v-model="dataForm.logTime"
type="datetime"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
placeholder="选择日期"></el-date-picker>
placeholder="选择日期"
:disabled="showDetail"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -89,7 +91,8 @@
<el-select
v-model="dataForm.source"
placeholder="请选择来源"
style="width: 100%">
style="width: 100%"
:disabled="showDetail">
<el-option
v-for="dict in sourceList"
:key="dict.id"
@ -100,13 +103,20 @@
</el-col>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" />
<el-input
v-model="dataForm.description"
placeholder="请输入描述"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4 }"
:disabled="showDetail" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" />
<el-input
v-model="dataForm.remark"
placeholder="备注"
:disabled="showDetail" />
</el-form-item>
</el-col>
</el-row>
@ -114,7 +124,6 @@
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import {
createQualityScrapLog,
updateQualityScrapLog,
@ -124,22 +133,12 @@ import {
getDetList,
getLineList,
} from '@/api/base/qualityScrapLog';
import { getList } from '@/api/base/qualityScrapType';
// import { getMaterialList } from "@/api/base/material";
// import { getList } from '@/api/base/qualityScrapType';
import moment from 'moment';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList: [],
typeList: [],
workOrderList: [],
detList: [],
teamList: [],
@ -160,15 +159,12 @@ export default {
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
num: null,
lineId: undefined,
description: undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [
{ required: true, message: '工单号不能为空', trigger: 'change' },
],
@ -181,79 +177,93 @@ export default {
{ required: true, message: '报废时间不能为空', trigger: 'change' },
],
},
showDetail: false,
};
},
mounted() {
this.getDict();
console.log('我看看', this.dataForm);
this.getCurrentTime();
this.getList();
},
methods: {
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date();
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
init(id, show) {
this.showDetail = show ? true : false;
this.dataForm.id = id || undefined;
if (id) {
//
getQualityScrapLog(id).then((res) => {
console.log(res);
this.dataForm = res.data;
this.dataForm.logTime = res.data.logTime || null;
console.log('==================');
});
} else {
this.dataForm.logTime = moment().format('yyyy-MM-DD hh:mm:ss');
}
},
async getDict() {
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
updateQualityScrapLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createQualityScrapLog(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
getList() {
//
const res = await getList();
this.typeList = res.data;
getWorkOrderList().then((res) => {
console.log(res);
// console.log(response);
this.workOrderList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
});
getLineList().then((res) => {
console.log(res);
// console.log(response);
this.lineList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
});
getDetList().then((res) => {
console.log(res);
// console.log(response);
this.detList = res.data.map((item) => {
return {
name: item.content,
id: item.id,
};
});
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
});
getTeamList().then((res) => {
console.log(res);
// console.log(response);
this.teamList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
// console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total;
});
},
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
formClear() {
this.$refs.dataForm.resetFields();
},
},
};
</script>

View File

@ -1,284 +0,0 @@
<!--
* @Author: zhp
* @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-11-07 19:38:13
* @LastEditors: zhp
* @Description:
-->
<template>
<el-dialog
:visible.sync="dialogVisible"
width="50%"
:before-close="handleClose">
<small-title slot="title" :no-padding="true">
{{ '详情' }}
</small-title>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="auto">
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="工单号" prop="workOrderId">
<el-select
v-model="dataForm.workOrderId"
placeholder="请选择工单号"
disabled>
<el-option
v-for="dict in workOrderList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select
v-model="dataForm.teamId"
placeholder="请选择班组"
disabled>
<el-option
v-for="dict in teamList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input
v-model="dataForm.sum"
placeholder="请输入数量"
disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select
v-model="dataForm.lineId"
placeholder="请选择产线"
disabled>
<el-option
v-for="dict in lineList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select
v-model="dataForm.detId"
placeholder="请选择报废原因"
disabled>
<el-option
v-for="dict in detList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废时间" prop="logTime">
<el-date-picker
v-model="dataForm.logTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
disabled
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="来源" prop="source">
<el-select
v-model="dataForm.source"
placeholder="请选择来源"
disabled>
<el-option
v-for="dict in sourceList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="描述" prop="description">
<el-input
v-model="dataForm.description"
placeholder="请输入描述"
disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import {
createQualityScrapLog,
updateQualityScrapLog,
getQualityScrapLog,
getWorkOrderList,
getTeamList,
getDetList,
getLineList,
} from '@/api/base/qualityScrapLog';
import { getList } from '@/api/base/qualityScrapType';
import SmallTitle from './SmallTitle';
export default {
components: {
SmallTitle,
},
mixins: [basicAdd],
data() {
return {
urlOptions: {
isGetCode: false,
// codeURL: getCode,
createURL: createQualityScrapLog,
updateURL: updateQualityScrapLog,
infoURL: getQualityScrapLog,
},
lineList: [],
typeList: [],
workOrderList: [],
detList: [],
teamList: [],
sourceList: [
{
id: 1,
name: '手动',
},
{
id: 2,
name: '自动',
},
],
dialogVisible: false,
dataForm: {
id: undefined,
logTime: undefined,
source: 1,
detId: undefined,
workOrderId: null,
teamId: undefined,
num: undefined,
lineId: undefined,
description: undefined,
// description: undefined,
remark: undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
workOrderId: [
{ required: true, message: '工单号不能为空', trigger: 'change' },
],
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
detId: [
{ required: true, message: '报废原因不能为空', trigger: 'change' },
],
logTime: [
{ required: true, message: '报废时间不能为空', trigger: 'change' },
],
},
};
},
mounted() {
// this.getDict()
console.log('我看看', this.dataForm);
this.getCurrentTime();
},
methods: {
init() {
this.dialogVisible = true;
},
getCurrentTime() {
// new Date().Format("yyyy-MM-dd HH:mm:ss")
this.dataForm.logTime = new Date();
// this.dataForm.logTime = year + "-" + month + "-" + day;
console.log(this.dataForm.logTime);
},
// async getDict() {
// //
// const res = await getList()
// this.typeList = res.data
// getWorkOrderList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getLineList().then((res) => {
// console.log(res);
// // console.log(response);
// this.lineList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getDetList().then((res) => {
// console.log(res);
// // console.log(response);
// this.workOrderList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// getTeamList().then((res) => {
// console.log(res);
// // console.log(response);
// this.teamList = res.data.map((item) => {
// return {
// name: item.name,
// id: item.id
// }
// })
// // console.log(this.formConfig[0].selectOptions);
// // this.listQuery.total = response.data.total;
// })
// },
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -26,24 +26,32 @@
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<el-row slot="footer" type="flex" justify="end">
<el-col :span="12">
<el-button size="small" class="btnTextStyle" @click="handleCancel">
{{ this.addOrEditTitle === '详情' ? '关闭' : '取消' }}
</el-button>
<el-button
v-show="this.addOrEditTitle !== '详情'"
type="primary"
size="small"
class="btnTextStyle"
@click="handleConfirm">
确定
</el-button>
</el-col>
</el-row>
</base-dialog>
<detail-or-update
v-if="detailOrUpdateVisible"
ref="detailOrUpdate"
@refreshDataList="successSubmit" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import DetailOrUpdate from './detail-or-updata';
import basicPage from '../../core/mixins/basic-page';
import { parseTime } from '../../core/mixins/code-filter';
@ -114,7 +122,6 @@ export default {
: undefined,
].filter((v) => v),
tableData: [],
detailOrUpdateVisible: false,
formConfig: [
{
type: 'select',
@ -152,11 +159,11 @@ export default {
plain: true,
},
],
showDetail: false,
};
},
components: {
AddOrUpdate,
DetailOrUpdate,
},
created() {
this.getDict();
@ -164,10 +171,10 @@ export default {
methods: {
otherMethods(val) {
if (val.type === 'detail') {
this.detailOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.addOrEditTitle = '详情';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id, true);
this.$refs.addOrUpdate.init(val.data.id, true);
});
}
},