Commit d265b45d authored by chenzj's avatar chenzj

领料申请添加新增功能

parent 22f7af6e
<template>
<div class="app-container">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">
新增</el-button>
<el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="物料编码" align="center" prop="sapItemCode" />
<el-table-column label="物料名称" align="center" prop="itemName" />
<el-table-column label="工作中心编码" align="center" prop="workstationCode" />
<el-table-column label="工作单元编码" align="center" prop="workunitCode" />
<el-table-column label="申请数量" align="center" prop="applyNum" />
<el-table-column width="100px" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="{ $index}">
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改调拨料申请对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col span="12">
<el-form-item label="产品编码" prop="sapItemCode">
<el-input v-model="form.sapItemCode" placeholder="请输入产品编码">
<el-button slot="append" icon="el-icon-search" @click="handleItemSelect" />
</el-input>
<itemSelect ref="brSelectpro" @onSelected="onItemSelect">
</itemSelect>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="产品名称" prop="itemName">
<el-input disabled v-model="form.itemName" placeholder="请输入产品名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col span="12">
<el-form-item label="工作中心编码" prop="workstationCode">
<el-input v-model="form.workstationCode" placeholder="请输入工作中心编码">
<el-button slot="append" icon="el-icon-search" @click="handleWorkstationSelect" />
</el-input>
</el-form-item>
<WorkstationSelect ref="brSelectworkstation"
@onSelected="val => onWorkstationSelect(val, 'workstation')"
:workstationCode="form.workstationCode">
</WorkstationSelect>
</el-col>
<el-col span="12">
<el-form-item label="工作单元" prop="workunitCode">
<el-input v-model="form.workunitCode" placeholder="工作单元">
<el-button slot="append" icon="el-icon-search"
@click="$refs.codeSelect.showFlag = true"></el-button>
</el-input>
</el-form-item>
</el-col>
</el-row>
<WorkstationSelect ref="brSelectworkstation"
@onSelected="val => onWorkstationSelect(val, 'workstation')"
:workstationCode="form.workstationCode">
</WorkstationSelect>
<codeSelect ref="codeSelect" :workstationId="form.workstationId"
@onSelected="val => onWorkstationSelect(val, 'unit')"></codeSelect>
<el-row>
<el-col span="12">
<el-form-item label="申请数量" prop="applyNum">
<el-input v-model="form.applyNum" placeholder="请输入申请数量" />
</el-form-item>
</el-col>
</el-row>
</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>
<!--
<pagination v-show="total > 0 && $attrs.optType !== 'add'" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" /> -->
</div>
</template>
<script>
import codeSelect from "./codeSelect.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
export default {
name: "TmToolRequestItem",
dicts: [
"warehouse_desc"
],
components: { ItemSelect, WorkstationSelect, codeSelect },
props: {
id: {
type: String,
default: ''
}
},
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
/**表格数据 */
tableData: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
optType: "add",
// 总条数
total: 0,
// 刀模版物料申请单表格数据
tmToolRequestItemList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
itemId: null,
sapItemCode: null,
itemName: null,
applyNum: null,
workstationCode: null,
workunitCode: null,
workstationCode: null,
workstationId: null,
workstationName: null,
},
// 表单参数
form: {
itemId: null,
sapItemCode: null,
itemName: null,
applyNum: null,
workstationCode: null,
workunitCode: null,
workstationCode: null,
workstationId: null,
workstationName: null,
},
currentRowIdx: undefined,
// 表单校验
rules: {
}
};
},
watch: {
},
created() {
if (this.$attrs.optType !== 'add') {
this.getList();
}
},
methods: {
// onItemSelect(list) {
// // console.log(list, 'list')
// const datas = list.map(item => {
// return {
// toolWarehouseId: item.toolWarehouseId,
// toolMachinesId: item.toolMachinesId,
// type: item.type,
// toolCode: item.toolCode,
// toolName: item.toolName,
// itemCode: item.itemCode,
// sapItemCode: item.sapItemCode,
// itemName: item.itemName,
// local: item.local,
// processId: Number(item.processId),
// processName: item.processName,
// warehouse: item.warehouse,
// warehouseDesc: item.warehouseDesc,
// }
// })
// this.tmToolRequestItemList = this.tmToolRequestItemList.concat(datas)
// this.$emit('sum')
// },
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加表体";
this.optType = "add";
},
handleItemSelect() {
this.$refs.brSelectpro.showFlag = true;
},
onItemSelect(row) {
if (row != undefined && row != null) {
this.form.itemId = row.itemId;
this.form.sapItemCode = row.sapItemCode;
this.form.itemName = row.itemName;
}
},
/**表单提交 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.optType == "add") {
this.tableData.unshift({ ...this.form });
}
this.showFlag = false;
}
});
this.open = false;
},
handleWorkstationSelect() {
this.$refs.brSelectworkstation.showFlag = true;
},
onWorkstationSelect(row, type) {
console.log('row', type, row)
if (row != undefined && row != null) {
if (type === 'unit') {
// this.form.workunitName = row.workunitName
this.$set(this.form, 'workunitCode', row.workunitCode)
this.form.workstationId = row.workstationId;
this.form.workstationCode = row.workstationCode;
this.form.workstationName = row.workstationName;
} else {
this.form.workstationId = row.workstationId;
this.form.workstationCode = row.workstationCode;
this.form.workstationName = row.workstationName;
}
}
},
/**删除行 */
deleteRow(index) {
this.tableData.splice(index, 1);
},
handleRemove(row, index) {
console.log(row, index)
// this.tags.splice(this.tags.indexOf(tag), 1)
this.tmToolRequestItemList.splice(this.tmToolRequestItemList.indexOf(row), 1)
this.$emit('sum')
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
// 表单重置
reset() {
this.form = {
itemId: null,
sapItemCode: null,
itemName: null,
applyNum: null,
workunitId: null,
workunitName: null,
workunitCode: null,
workstationCode: null,
workstationId: null,
workstationName: null,
};
this.resetForm("form");
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.toolRequestItemId)
this.single = selection.length !== 1
this.multiple = !selection.length
}
}
};
</script>
\ No newline at end of file
<template>
<el-dialog title="工单选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="工单编码" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
placeholder="请输入工单编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工单名称" prop="workorderName">
<el-input
v-model="queryParams.workorderName"
placeholder="请输入工单名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品编号" prop="productCode">
<el-input
v-model="queryParams.productCode"
placeholder="请输入产品编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="clientName">
<el-input
v-model="queryParams.clientName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="workorderList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
<el-table-column width="55" align="center" >
<template v-slot="scope">
<el-radio v-model="selectedWorkorderId" :label="scope.row.workorderId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
</template>
</el-table-column>
<el-table-column label="工单编码" width="180" prop="workorderCode" >
</el-table-column>
<el-table-column label="工单名称" width="200" align="center" prop="workorderName" :show-overflow-tooltip="true"/>
<el-table-column label="工单来源" align="center" prop="orderSource" >
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_sourcetype" :value="scope.row.orderSource"/>
</template>
</el-table-column>
<el-table-column label="订单编号" width="140" align="center" prop="sourceCode" />
<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="规格型号" align="center" prop="productSpc" :show-overflow-tooltip="true"/>
<el-table-column label="单位" align="center" prop="unitOfMeasure" />
<el-table-column label="工单数量" align="center" prop="quantity" />
<el-table-column label="客户编码" align="center" prop="clientCode" />
<el-table-column label="客户名称" align="center" prop="clientName" :show-overflow-tooltip="true"/>
<el-table-column label="需求日期" align="center" prop="requestDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.requestDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listWorkorder} from "@/api/mes/pro/workorder";
export default {
name: 'WorkOrderSelectSingle',
components: {},
dicts: ['mes_order_status','mes_workorder_sourcetype'],
props:{
workorder: {
type: Object,
default: function(){
return {}
}} //外部传入的工单过滤信息
},
watch: {
arrangeCode(v){
if(v){
this.queryParams.arrangeCode = v;
this.getList();
}
}
},
data() {
return {
showFlag: false,
// 遮罩层
loading: true,
// 选中数组
selectedWorkorderId: undefined,
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 生产工单表格数据
workorderList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
workorderCode: null,
workorderName: null,
workorderType: this.workorder.workorderType,
orderSource: null,
sourceCode: null,
productId: null,
productCode: null,
productName: null,
productSpc: null,
unitOfMeasure: null,
quantity: null,
arrangeCode: null,
quantityProduced: null,
quantityChanged: null,
quantityScheduled: null,
clientId: null,
clientCode: null,
clientName: null,
requestDate: null,
parentId: null,
ancestors: null,
status: null,
},
}
},
created() {
this.getList();
},
methods:{
/** 查询生产工单列表 */
getList() {
this.loading = true;
listWorkorder(this.queryParams).then(response => {
this.workorderList = response.rows;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleCurrent(row){
if(row){
this.selectedRows = row;
}
},
// 单选选中数据
handleRowChange(row) {
if(row){
this.selectedRows = row;
}
},
//双击选中
handleRowDbClick(row){
if(row){
this.selectedRows = row;
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
},
//确定选中
confirmSelect(){
if(this.selectedWorkorderId == null || this.selectedWorkorderId == 0){
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据!'
});
return;
}
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
}
}
</script>
......@@ -34,10 +34,10 @@
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['pro:materialRequest:add']">新增</el-button>
</el-col> -->
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
......@@ -131,7 +131,7 @@
<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="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" :disabled="form.materialRequestId && optType != 'edit'"
label-width="100px">
......@@ -230,6 +230,77 @@
</div>
</el-dialog>
<!-- 添加领料申请对话框 -->
<el-dialog :title="title" :visible.sync="opens" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" :disabled="form.materialRequestId && optType != 'edit'"
label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="申请号" prop="applyNo">
<el-input v-model="form.applyNo" placeholder="请输入申请号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务单号" prop="taskCode">
<el-input v-model="form.taskCode" placeholder="请选任务单号" readonly="readonly">
<el-button slot="append" icon="el-icon-search" @click="handleBrandSelect"
:disabled="form.materialRequestId"></el-button>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="编排单号" prop="arrangeCode">
<el-input v-model="form.arrangeCode" placeholder="请输入编排单号" >
<el-button slot="append" icon="el-icon-search" @click="$refs.arangeSelect.showFlag = true"
:disabled="form.materialRequestId"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工单号" prop="workorderCode">
<el-input v-model="form.workorderCode" placeholder="请输入编排单号" >
<el-button slot="append" icon="el-icon-search" @click="$refs.workorderselect.showFlag = true"
:disabled="form.materialRequestId"></el-button>
</el-input>
</el-form-item>
</el-col>
</el-row>
<BrandSelect ref="brSelect" :arrangeCode="form.arrangeCode" @onSelected="onBrandSelected"></BrandSelect>
<arangeSelect ref="arangeSelect" :arrangeCode="form.arrangeCode" @onSelected="onBrandSelected"></arangeSelect>
<workorderSelect ref="workorderselect" :arrangeCode="form.arrangeCode" @onSelected="onWorkorderSelected"></workorderSelect>
<el-row>
<el-col :span="12">
<el-form-item label="申请时间" prop="createTime">
<el-date-picker clearable v-model="form.createTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择申请时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="需求日期" prop="startTime">
<el-date-picker clearable v-model="form.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择需求日期">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider content-position="center">调拨料表体</el-divider>
<el-card shadow="always" class="box-card">
<requestIndex v-if="opens" ref="allocationRef" :quantity="form.requestNum" :id="form.toolWarehouseId"
:optType="optType"></requestIndex>
</el-card>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType == 'view'">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="optType != 'view'">确 定</el-button>
<el-button @click="cancels" v-if="optType != 'view'">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -239,13 +310,15 @@ import { genCode } from "@/api/system/autocode/rule";
import BrandSelect from "@/components/TaskSelect/sngle.vue";
import arangeSelect from "./components/arangeSelect.vue";
import codeSelect from "./components/codeSelect.vue";
import workorderSelect from "./components/workorderSelect.vue";
import requestIndex from "./components/requestIndex.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import { listWorkunit} from "@/api/mes/md/workunit";
export default {
name: "MaterialRequest",
components: { BrandSelect,WorkstationSelect,ItemSelect, arangeSelect, codeSelect },
components: { BrandSelect,WorkstationSelect,ItemSelect, arangeSelect, codeSelect ,requestIndex ,workorderSelect},
dicts: ['pro_requisition_type', 'pro_material_from', 'sys_yes_no'],
data() {
return {
......@@ -270,6 +343,8 @@ export default {
daterangePurchaseDate: [],
// 是否显示弹出层
open: false,
opens: false,
// 查询参数
queryParams: {
pageNum: 1,
......@@ -320,6 +395,12 @@ export default {
}
},
onWorkorderSelected(row) {
if (row != undefined && row != null) {
}
},
handleItemSelect() {
this.$refs.ItemSelect.showFlag = true;
},
......@@ -384,6 +465,12 @@ export default {
this.open = false;
this.reset();
},
// 取消按钮
cancels() {
this.opens = false;
this.reset();
},
// 表单重置
reset() {
......@@ -440,7 +527,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.opens = true;
this.gCode();
this.title = "添加领料申请";
this.optType = "add";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment