工单添加BOM组成信息
This commit is contained in:
parent
93ef031093
commit
0c3b0ecb19
44
src/api/mes/pro/workorderbom.js
Normal file
44
src/api/mes/pro/workorderbom.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询生产工单BOM组成列表
|
||||||
|
export function listWorkorderbom(query) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/pro/workorderbom/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询生产工单BOM组成详细
|
||||||
|
export function getWorkorderbom(lineId) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/pro/workorderbom/' + lineId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增生产工单BOM组成
|
||||||
|
export function addWorkorderbom(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/pro/workorderbom',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改生产工单BOM组成
|
||||||
|
export function updateWorkorderbom(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/pro/workorderbom',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除生产工单BOM组成
|
||||||
|
export function delWorkorderbom(lineId) {
|
||||||
|
return request({
|
||||||
|
url: '/mes/pro/workorderbom/' + lineId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
235
src/views/mes/pro/workorder/bom/bom.vue
Normal file
235
src/views/mes/pro/workorder/bom/bom.vue
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['mes:pro:workorderbom:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="workorderbomList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="BOM物料编号" width="120" align="center" prop="itemCode" />
|
||||||
|
<el-table-column label="BOM物料名称" width="200" align="center" prop="itemName" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="规格型号" align="center" prop="itemSpc" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="单位" align="center" prop="unitOfMeasure" />
|
||||||
|
<el-table-column label="物料/产品" align="center" prop="itemOrProduct" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.mes_item_product" :value="scope.row.itemOrProduct"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="预计使用量" align="center" prop="quantity" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['mes:pro:workorderbom:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改生产工单BOM组成对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="预计使用量" prop="quantity">
|
||||||
|
<el-input v-model="form.quantity" placeholder="请输入预计使用量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listWorkorderbom, getWorkorderbom, delWorkorderbom, addWorkorderbom, updateWorkorderbom } from "@/api/mes/pro/workorderbom";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Workorderbom",
|
||||||
|
dicts: ['mes_item_product'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 生产工单BOM组成表格数据
|
||||||
|
workorderbomList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
workorderId: null,
|
||||||
|
itemId: null,
|
||||||
|
itemCode: null,
|
||||||
|
itemName: null,
|
||||||
|
itemSpc: null,
|
||||||
|
unitOfMeasure: null,
|
||||||
|
itemOrProduct: null,
|
||||||
|
quantity: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
workorderId: [
|
||||||
|
{ required: true, message: "生产工单ID不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemId: [
|
||||||
|
{ required: true, message: "BOM物料ID不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemCode: [
|
||||||
|
{ required: true, message: "BOM物料编号不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemName: [
|
||||||
|
{ required: true, message: "BOM物料名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
unitOfMeasure: [
|
||||||
|
{ required: true, message: "单位不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
itemOrProduct: [
|
||||||
|
{ required: true, message: "物料产品标识不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
quantity: [
|
||||||
|
{ required: true, message: "预计使用量不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
optType: undefined,
|
||||||
|
workorderId: undefined
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询生产工单BOM组成列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
this.queryParams.workorderId = this.workorderId;
|
||||||
|
listWorkorderbom(this.queryParams).then(response => {
|
||||||
|
this.workorderbomList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
lineId: null,
|
||||||
|
workorderId: null,
|
||||||
|
itemId: null,
|
||||||
|
itemCode: null,
|
||||||
|
itemName: null,
|
||||||
|
itemSpc: null,
|
||||||
|
unitOfMeasure: null,
|
||||||
|
itemOrProduct: null,
|
||||||
|
quantity: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.lineId)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const lineId = row.lineId || this.ids
|
||||||
|
getWorkorderbom(lineId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改生产工单BOM组成";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.lineId != null) {
|
||||||
|
updateWorkorderbom(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addWorkorderbom(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('mes/pro/workorderbom/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `workorderbom_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -17,7 +17,6 @@
|
|||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="来源单据" prop="sourceCode">
|
<el-form-item label="来源单据" prop="sourceCode">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.sourceCode"
|
v-model="queryParams.sourceCode"
|
||||||
@ -82,7 +81,7 @@
|
|||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['pro:workorder:add']"
|
v-hasPermi="['mes:pro:workorder:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -93,7 +92,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['pro:workorder:edit']"
|
v-hasPermi="['mes:pro:workorder:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -104,7 +103,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['pro:workorder:remove']"
|
v-hasPermi="['mes:pro:workorder:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -114,22 +113,27 @@
|
|||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['pro:workorder:export']"
|
v-hasPermi="['mes:pro:workorder:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="workorderList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
v-loading="loading"
|
||||||
<el-table-column label="工单编码" width="150" align="center" prop="workorderCode" />
|
:data="workorderList"
|
||||||
|
row-key="workorderId"
|
||||||
|
default-expand-all
|
||||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
|
>
|
||||||
|
<el-table-column label="工单编码" width="180" prop="workorderCode" />
|
||||||
<el-table-column label="工单名称" width="200" align="center" prop="workorderName" :show-overflow-tooltip="true"/>
|
<el-table-column label="工单名称" width="200" align="center" prop="workorderName" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="来源类型" align="center" prop="orderSource" >
|
<el-table-column label="工单来源" align="center" prop="orderSource" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.mes_workorder_sourcetype" :value="scope.row.orderSource"/>
|
<dict-tag :options="dict.type.mes_workorder_sourcetype" :value="scope.row.orderSource"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="订单编号" align="center" prop="sourceCode" />
|
<el-table-column label="订单编号" width="120" align="center" prop="sourceCode" />
|
||||||
<el-table-column label="产品编号" width="120" align="center" prop="productCode" />
|
<el-table-column label="产品编号" width="120" align="center" prop="productCode" />
|
||||||
<el-table-column label="产品名称" width="200" align="center" prop="productName" :show-overflow-tooltip="true"/>
|
<el-table-column label="产品名称" width="200" align="center" prop="productName" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="规格型号" align="center" prop="productSpc" :show-overflow-tooltip="true"/>
|
<el-table-column label="规格型号" align="center" prop="productSpc" :show-overflow-tooltip="true"/>
|
||||||
@ -147,36 +151,36 @@
|
|||||||
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" width="100px" class-name="small-padding fixed-width">
|
<el-table-column label="操作" width="150px" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-if="scope.row.status =='PREPARE'"
|
v-if="scope.row.status =='PREPARE'"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['mes:pro:workorder:edit']"
|
v-hasPermi="['mes:pro:workorder:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
v-if="scope.row.status =='CONFIRMED'"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
v-hasPermi="['mes:pro:workorder:add']"
|
||||||
|
>新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-if="scope.row.status =='PREPARE'"
|
v-if="scope.row.status =='PREPARE'"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['mes:pro:workorder:remove']"
|
v-hasPermi="['mes:pro:workorder:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改生产工单对话框 -->
|
<!-- 添加或修改生产工单对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
@ -191,7 +195,7 @@
|
|||||||
<el-switch v-model="autoGenFlag"
|
<el-switch v-model="autoGenFlag"
|
||||||
active-color="#13ce66"
|
active-color="#13ce66"
|
||||||
active-text="自动生成"
|
active-text="自动生成"
|
||||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view' && form.status =='PREPARE'">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -311,9 +315,16 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<el-tabs type="border-card" v-if="form.workorderId != null">
|
||||||
|
<el-tab-pane label="BOM组成">
|
||||||
|
<Workorderbom ref="bomlist" :optType="optType" :workorderId="form.workorderId"></Workorderbom>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="物料需求"></el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
|
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
|
||||||
<el-button type="primary" @click="submitForm" v-else>确 定</el-button>
|
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' ">确 定</el-button>
|
||||||
|
<el-button type="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && form.workorderId !=null">完成</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -322,13 +333,22 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listWorkorder, getWorkorder, delWorkorder, addWorkorder, updateWorkorder } from "@/api/mes/pro/workorder";
|
import { listWorkorder, getWorkorder, delWorkorder, addWorkorder, updateWorkorder } from "@/api/mes/pro/workorder";
|
||||||
|
import Workorderbom from "./bom/bom.vue";
|
||||||
import ItemSelect from "@/components/itemSelect/single.vue";
|
import ItemSelect from "@/components/itemSelect/single.vue";
|
||||||
import ClientSelect from "@/components/clientSelect/single.vue";
|
import ClientSelect from "@/components/clientSelect/single.vue";
|
||||||
import {genCode} from "@/api/system/autocode/rule"
|
import {genCode} from "@/api/system/autocode/rule"
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Workorder",
|
name: "Workorder",
|
||||||
dicts: ['mes_order_status','mes_workorder_sourcetype'],
|
dicts: ['mes_order_status','mes_workorder_sourcetype'],
|
||||||
components: { ItemSelect ,ClientSelect},
|
components: {
|
||||||
|
Treeselect,
|
||||||
|
ItemSelect ,
|
||||||
|
ClientSelect,
|
||||||
|
Workorderbom
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//自动生成编码
|
//自动生成编码
|
||||||
@ -336,26 +356,22 @@ export default {
|
|||||||
optType: undefined,
|
optType: undefined,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 显示搜索条件
|
||||||
ids: [],
|
showSearch: true,
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 生产工单表格数据
|
// 生产工单表格数据
|
||||||
workorderList: [],
|
workorderList: [],
|
||||||
|
// 生产工单树选项
|
||||||
|
workorderOptions: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
workorderCode: null,
|
workorderCode: null,
|
||||||
workorderName: null,
|
workorderName: null,
|
||||||
orderSource: null,
|
orderSource: null,
|
||||||
@ -370,6 +386,8 @@ export default {
|
|||||||
clientCode: null,
|
clientCode: null,
|
||||||
clientName: null,
|
clientName: null,
|
||||||
requestDate: null,
|
requestDate: null,
|
||||||
|
parentId: null,
|
||||||
|
ancestors: null,
|
||||||
status: null,
|
status: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
@ -386,7 +404,7 @@ export default {
|
|||||||
{ required: true, message: "来源类型不能为空", trigger: "blur" }
|
{ required: true, message: "来源类型不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
productId: [
|
productId: [
|
||||||
{ required: true, message: "产品ID不能为空", trigger: "blur" }
|
{ required: true, message: "产品不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
productCode: [
|
productCode: [
|
||||||
{ required: true, message: "产品编号不能为空", trigger: "blur" }
|
{ required: true, message: "产品编号不能为空", trigger: "blur" }
|
||||||
@ -414,11 +432,30 @@ export default {
|
|||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listWorkorder(this.queryParams).then(response => {
|
listWorkorder(this.queryParams).then(response => {
|
||||||
this.workorderList = response.rows;
|
this.workorderList = this.handleTree(response.data, "workorderId", "parentId");
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 转换生产工单数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.workorderId,
|
||||||
|
label: node.workorderName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/** 查询生产工单下拉树结构 */
|
||||||
|
getTreeselect() {
|
||||||
|
listWorkorder().then(response => {
|
||||||
|
this.workorderOptions = [];
|
||||||
|
const data = { workorderId: 0, workorderName: '顶级节点', children: [] };
|
||||||
|
data.children = this.handleTree(response.data, "workorderId", "parentId");
|
||||||
|
this.workorderOptions.push(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -442,12 +479,9 @@ export default {
|
|||||||
clientCode: null,
|
clientCode: null,
|
||||||
clientName: null,
|
clientName: null,
|
||||||
requestDate: null,
|
requestDate: null,
|
||||||
status: 'PREPARE',
|
parentId: null,
|
||||||
|
status: "PREPARE",
|
||||||
remark: null,
|
remark: null,
|
||||||
attr1: null,
|
|
||||||
attr2: null,
|
|
||||||
attr3: null,
|
|
||||||
attr4: null,
|
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
@ -458,7 +492,6 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
@ -466,26 +499,36 @@ export default {
|
|||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.workorderId)
|
|
||||||
this.single = selection.length!==1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
this.getTreeselect();
|
||||||
|
if (row != null && row.workorderId) {
|
||||||
|
this.form.parentId = row.workorderId;
|
||||||
|
this.form.orderSource = row.orderSource;
|
||||||
|
this.form.sourceCode = row.sourceCode;
|
||||||
|
this.form.clientId = row.clientId;
|
||||||
|
this.form.clientCode = row.clientCode;
|
||||||
|
this.form.clientName = row.clientName;
|
||||||
|
} else {
|
||||||
|
this.form.parentId = 0;
|
||||||
|
}
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加生产工单";
|
this.title = "添加生产工单";
|
||||||
|
this.optType="add";
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const workorderId = row.workorderId || this.ids
|
this.getTreeselect();
|
||||||
getWorkorder(workorderId).then(response => {
|
if (row != null) {
|
||||||
|
this.form.parentId = row.workorderId;
|
||||||
|
}
|
||||||
|
getWorkorder(row.workorderId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改生产工单";
|
this.title = "修改生产工单";
|
||||||
|
this.optType="edit";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
@ -495,13 +538,15 @@ export default {
|
|||||||
if (this.form.workorderId != null) {
|
if (this.form.workorderId != null) {
|
||||||
updateWorkorder(this.form).then(response => {
|
updateWorkorder(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
//this.open = false;
|
||||||
|
this.$refs["bomlist"].getList();
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addWorkorder(this.form).then(response => {
|
addWorkorder(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
//this.open = false;
|
||||||
|
this.form.workorderId = response.data;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -510,25 +555,31 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const workorderIds = row.workorderId || this.ids;
|
this.$modal.confirm('是否确认删除生产工单编号为"' + row.workorderId + '"的数据项?').then(function() {
|
||||||
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderIds + '"的数据项?').then(function() {
|
return delWorkorder(row.workorderId);
|
||||||
return delWorkorder(workorderIds);
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
|
handleSelectProduct(){
|
||||||
|
this.$refs.itemSelect.showFlag = true;
|
||||||
|
},
|
||||||
|
handleSelectClient(){
|
||||||
|
this.$refs.clientSelect.showFlag = true;
|
||||||
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('mes/pro/workorder/export', {
|
this.download('mes/pro/workorder/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `workorder_${new Date().getTime()}.xlsx`)
|
}, `workorder_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
handleSelectProduct(){
|
handleFinish(){
|
||||||
this.$refs.itemSelect.showFlag = true;
|
let that = this;
|
||||||
},
|
this.$modal.confirm('是否完成工单编制?【完成后将不能更改】').then(function(){
|
||||||
handleSelectClient(){
|
that.form.status = 'CONFIRMED';
|
||||||
this.$refs.clientSelect.showFlag = true;
|
that.submitForm();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
//物料选择弹出框
|
//物料选择弹出框
|
||||||
onItemSelected(obj){
|
onItemSelected(obj){
|
||||||
|
Loading…
Reference in New Issue
Block a user