Commit dc9b3799 authored by chenzj's avatar chenzj

Merge branch 'dev' of http://git.local.topsunit.com/mes/mes-ui into dev

parents 84e3c8f0 66dc3921
import request from '@/utils/request'
// 查询刀模版入库列表
export function lisWoreHouse(query) {
return request({
url: "/md/warehouse/list",
method: "get",
params: query,
});
}
// 查询刀模版入库详情列表
export function lisWoreHouseDetail(query) {
return request({
url: `/md/warehouse/${query.toolWarehouseid}`,
method: "get"
});
}
// 新增刀模版入库
export function addWoreHouse(data) {
return request({
url: "/md/warehouse",
method: "post",
data: data,
});
}
......@@ -138,7 +138,7 @@
<span>{{ scope.row.warehouse == '2'? '是': '否' }}</span>
</template>
</el-table-column>
<el-table-column label="入库原因" align="center" prop="warehouseDesc" width="120"/>
<el-table-column label="入库方式" align="center" prop="warehouseDesc" width="120"/>
<el-table-column label="上机时间" width="120" align="center" prop="upDate" />
<el-table-column label="下机时间" width="120" align="center" prop="downDate" />
<el-table-column label="物料名称" width="150" align="center" prop="itemName" />
......@@ -182,12 +182,12 @@
<!-- 入库对话框 -->
<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="warehouseDesc">
<el-select value="['','']"
v-model="form.warehouseDesc"
clearable
style="width:100%;"
placeholder="请选择入库原因"
<el-form-item label="入库方式" prop="warehouseDesc">
<el-select
v-model="form.warehouseDesc"
clearable
style="width:100%;"
placeholder="请选择入库方式"
>
<el-option
v-for="dict in dict.type.warehouse_desc"
......@@ -254,7 +254,7 @@ export default {
// 表单校验
rules: {
warehouseDesc:[
{ required: true, message: '请选择入库原因', trigger: 'change' }
{ required: true, message: '请选择入库方式', trigger: 'change' }
]
}
};
......
......@@ -520,7 +520,7 @@ export default {
}
})
console.log(datas, 'datas')
addTmToolRequest(this.form).then(response => {
addTmToolRequest(datas).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......
<template>
<div class="app-container">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-row>
<el-col :span="6">
<el-form-item label="工序任务编码" prop="taskCode">
<el-input
v-model="queryParams.taskCode"
placeholder="请输入工序任务编码"
clearable
style="width:220px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="上机状态" prop="type">
<el-select v-model="queryParams.type" style="width:220px;" multiple placeholder="请选择上机状态" @change="handleType" clearable>
<el-option label="上机" value="1" />
<el-option label="下机" value="2" />
<el-option label="待上机" value="3" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="是否入库" prop="warehouseStr">
<el-select v-model="queryParams.warehouseStr" style="width:220px;" placeholder="请选择是否入库" clearable>
<el-option label="是" value="2" />
<el-option label="否" value="1" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<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-col>
</el-row>
</el-form> -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['tm:toolmachinesrecord:add']"
>新增</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['tm:toolmachinesrecord:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['tm:toolmachinesrecord:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['tm:toolmachinesrecord:export']"
>导出</el-button>
</el-col> -->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="刀模板入库单编码" min-width="150" align="center" prop="toolWarehouseCode" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="更新人" align="center" prop="updateBy"/>
<el-table-column label="创建时间" align="center" prop="createTime"/>
<el-table-column label="更新时间" align="center" prop="updateTime"/>
</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="950px" 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="toolWarehouseCode">
<el-input v-model="form.toolWarehouseCode" disabled placeholder="自动生成" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-divider content-position="center">入库申请详细</el-divider>
<el-card shadow="always" class="box-card">
<itemline ref="line" :quantity="form.requestNum" :toolRequestId="form.toolRequestId" :optType="optType"></itemline>
</el-card>
<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 { lisWoreHouse, addWoreHouse } from "@/api/mes/tm/warehouse";
import itemline from './itemIndex'
import { genCode } from "@/api/system/autocode/rule";
export default {
components: {
itemline
},
name: "warehouse",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 刀模版上下机记录表格数据
recordList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
optType: null,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
taskCode: null,
workunitId: null,
workunitName: null,
type: null,
typeStr: null,
warehouseStr: null,
toolRequestUseItemId: null,
upDate: null,
downDate: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
warehouseDesc:[
{ required: true, message: '请选择入库原因', trigger: 'change' }
]
},
itemCode: null
};
},
created() {
this.getList();
},
methods: {
handleType(e) {
console.log(e, 'type')
if (e.length > 0) {
this.$set(this.queryParams, 'typeStr', e.join(',') )
} else {
this.$set(this.queryParams, 'typeStr', '' )
}
console.log(this.queryParams, 'this.queryParams')
},
handleInWareHouse(e) {
console.log(e, 'House')
},
/** 查询刀模版上下机记录列表 */
getList() {
this.loading = true;
const params = Object.assign({}, this.queryParams)
delete params.type
lisWoreHouse(params).then(response => {
this.recordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 生成编码 */
gCode() {
genCode("TM_TOOL_WAREHOUSE_CODE").then((response) => {
console.log(response, 'toolWarehouseCode')
this.form.toolWarehouseCode = response;
});
},
/** 生成编码 */
gItemCode() {
genCode("TM_TOOL_WAREHOUSE_ITEM_CODE").then((response) => {
this.itemCode = response;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
toolWarehouseCode: 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.toolMachinesRecordId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.gCode()
this.gItemCode()
this.open = true;
this.optType = 'add'
this.title = "添加入库申请单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign(row, {})
this.open = true;
this.title = "申请入库";
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.toolMachinesRecordId != null) {
const params = {
"type": this.form.type,
  "warehouse": this.form.warehouse,
  "toolMachinesRecordId": this.form.toolMachinesRecordId,
  "warehouseDesc": this.form.warehouseDesc
}
// updateRecordWarehouse(params).then(response => {
// this.$modal.msgSuccess("修改成功");
// this.open = false;
// this.getList();
// });
} else {
let flag = true
let message = []
this.$refs.line.tmToolRequestItemList.forEach((value,index) => {
const length = index+1
if (!value.local) {
message.push('请填写第'+length+'行入库位置')
flag = false
} else if (!value.warehouseDesc) {
message.push('请填写第'+length+'行入库方式')
flag = false
}
});
if (!flag) {
this.$message.error(message[0])
return
}
const params = {
...this.form,
warehouseItemList: this.$refs.line.tmToolRequestItemList.map((item)=> {
return {
...item,
toolWarehouseItemCode:this.itemCode
}
})
}
addWoreHouse(params).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const toolMachinesRecordIds = row.toolMachinesRecordId || this.ids;
this.$modal.confirm('是否确认删除刀模版上下机记录编号为"' + toolMachinesRecordIds + '"的数据项?').then(function() {
return delRecord(toolMachinesRecordIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('md/record/export', {
...this.queryParams
}, `record_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-button
v-if="$attrs.optType === 'add'"
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="$refs['ItemSelectRef'].showFlag = true"
>新增</el-button>
<ItemSelect ref="ItemSelectRef" @onSelected="onItemSelect" />
<el-table v-loading="loading" :data="tmToolRequestItemList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column
type="index"
width="50"/>
<el-table-column label="物料编码" align="center" prop="itemCode" />
<el-table-column width="100px" label="物料名称" align="center" prop="itemName" />
<el-table-column width="100px" label="SN号" align="center" prop="toolCode" />
<el-table-column width="120px" v-if="$attrs.optType === 'add'" label="入库位置" align="center" prop="local" >
<template slot-scope="scope">
<el-input v-model="scope.row.local" @blur="$emit('sum')" placeholder="请输入入库位置" />
</template>
</el-table-column>
<el-table-column width="120px" v-else label="入库位置" align="center" prop="local" />
<el-table-column width="240px" v-if="$attrs.optType === 'add'" label="入库方式" align="center" prop="warehouseDesc">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.warehouseDesc">
<el-radio v-for="dict in dict.type.warehouse_desc"
:key="dict.value" :label="dict.label">{{ dict.label }}</el-radio>
</el-radio-group>
</template>
</el-table-column>
<el-table-column width="120px" v-else label="入库方式" align="center" prop="warehouseDesc" />
<el-table-column width="100px" v-if="$attrs.optType === 'add'" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleRemove(scope.row, scope.$index)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0&&$attrs.optType !== 'add'"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { lisWoreHouseDetail, getTmToolRequestItem, delTmToolRequestItem, addTmToolRequestItem, updateTmToolRequestItem } from "@/api/mes/tm/tmToolRequestItem";
import { getTaskIdMaxProcessTool } from "@/api/mes/pro/protask";
import ItemSelect from "./selectmachinesrecord.vue";
export default {
name: "TmToolRequestItem",
dicts: [
"warehouse_desc"
],
components: {ItemSelect},
props:{
toolRequestId:{
type:String,
default:''
}
},
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 刀模板物料申请单表格数据
tmToolRequestItemList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
toolRequestId: null, itemId: null, allQuantity: null, nextMaintenPeriod: null, },
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
watch: {
'$attrs.taskId'(newVal, oldVal){
if (this.$attrs.optType === 'add') {
this.getTaskList()
}
}
},
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,
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')
},
/** 查询刀模板物料申请单列表 */
getList() {
this.loading = true;
this.queryParams.toolWarehouseid = this.toolRequestId;
lisWoreHouseDetail(this.queryParams).then(response => {
this.tmToolRequestItemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询任务刀模板申请单列表 */
getTaskList() {
this.loading = true;
this.queryParams.taskId = this.$attrs.taskId;
this.queryParams.pageSize = 10000;
getTaskIdMaxProcessTool(this.queryParams).then(response => {
const datas = response.data.map(item => {
return {
...item,
allQuantity: item.AllQuantity
}
});
this.tmToolRequestItemList = this.tmToolRequestItemList.concat(datas)
// this.total = response.total;
this.loading = false;
this.$emit('sum')
});
},
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();
},
/** 重置按钮操作 */
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>
<template>
<el-dialog
title="请选择刀模版入库申请单"
v-if="showFlag"
:visible.sync="showFlag"
:modal="true"
width="80%"
append-to-body
:destroy-on-close="true"
:close-on-click-modal="false"
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="工作单元名称" prop="workunitName">
<el-input
v-model="queryParams.taskid"
placeholder="请输入工作单元名称"
style="width:220px;"
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="itemList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="物料编码" align="center" prop="itemCode" />
<el-table-column label="物料名称" align="center" prop="itemName" />
<el-table-column label="SN号" align="center" prop="toolCode" />
<el-table-column label="工序" align="center" prop="processId" />
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
</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 { listRecord } from "@/api/mes/tm/toolmachinesrecord";
import { genCode } from "@/api/system/autocode/rule";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/mes/md/itemtype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "MdItemSingle",
dicts: ["sys_yes_no", "mes_item_product"],
components: { Treeselect },
data() {
return {
showFlag: false,
// 选中数组
ids: [],
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 物料产品表格数据
itemList: null,
// 部门树选项
itemTypeOptions: undefined,
// 部门名称
itemTypeName: undefined,
defaultProps: {
children: "children",
label: "label",
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
// typeStr: '2',
// warehouseStr: '1'
},
};
},
watch: {
// 根据名称筛选分类树
itemTypeName(val) {
this.$refs.tree.filter(val);
},
},
created() {
},
mounted() {
this.getList();
},
methods: {
/** 查询物料编码列表 */
getList() {
this.loading = true;
listRecord(this.queryParams).then((response) => {
this.itemList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.itemId);
this.single = selection.length != 1;
this.multiple = !selection.length;
this.selectedRows = selection;
},
//确定选中
confirmSelect(){
if(this.ids.length==0) {
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据!'
});
return;
}
console.log(this.selectedRows)
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
},
};
</script>
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