257 lines
6.1 KiB
Plaintext
257 lines
6.1 KiB
Plaintext
<template>
|
|
<div class="app-container">
|
|
<el-form :model="queryParams" ref="queryParams" :inline="true">
|
|
<el-form-item label="物料编码" prop="materialCode" label-width="70px">
|
|
<el-input
|
|
v-model="queryParams.materialCode"
|
|
placeholder="物料编码"
|
|
:clearable="true"
|
|
size="small"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="物料名称" prop="materialName">
|
|
<el-input
|
|
v-model="queryParams.materialName"
|
|
placeholder="物料名称"
|
|
:clearable="true"
|
|
size="small"
|
|
/>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
size="mini"
|
|
@click="getList"
|
|
>搜索</el-button
|
|
>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
>重置</el-button
|
|
>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
icon="el-icon-plus"
|
|
type="primary"
|
|
size="mini"
|
|
@click="AddHeader"
|
|
>新增
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5" style="margin-left: 10px">
|
|
<el-button
|
|
icon="el-icon-delete"
|
|
type="danger"
|
|
size="mini"
|
|
:disabled="buttonEnable"
|
|
@click="handleDelete"
|
|
>删除
|
|
</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-table
|
|
v-loading="loading"
|
|
lazy
|
|
border
|
|
:data="tableData"
|
|
ref="list"
|
|
height="400px"
|
|
highlight-current-row
|
|
@current-change="currentChange"
|
|
>
|
|
<el-table-column
|
|
type="index"
|
|
align="center"
|
|
label="序号"
|
|
width="50"
|
|
></el-table-column>
|
|
<el-table-column
|
|
width="250px"
|
|
align="center"
|
|
label="物料编码"
|
|
prop="materialCode"
|
|
:show-overflow-tooltip="true"
|
|
></el-table-column>
|
|
<el-table-column
|
|
width="270px"
|
|
align="center"
|
|
label="物料名称"
|
|
prop="materialName"
|
|
:show-overflow-tooltip="true"
|
|
></el-table-column>
|
|
<el-table-column
|
|
width="270px"
|
|
align="center"
|
|
label="物料规格"
|
|
prop="materialSpec"
|
|
:show-overflow-tooltip="true"
|
|
></el-table-column>
|
|
</el-table>
|
|
<pagination
|
|
v-show="total > 0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNo"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import selectMaterial from "../../plan/order/prod/order-prod-select-material.vue";
|
|
|
|
export default {
|
|
name: "edit",
|
|
props: {
|
|
layerid: {
|
|
//自动注入的layerid
|
|
type: String,
|
|
default: "",
|
|
},
|
|
row: {
|
|
//传递的数据
|
|
type: Object,
|
|
default: () => {
|
|
return {};
|
|
},
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
buttonEnable: true,
|
|
propThis: this,
|
|
loading: true,
|
|
tableData: [],
|
|
queryParams: {
|
|
pageNo: 1,
|
|
pageSize: 50,
|
|
materialCode:null,
|
|
materialName:null,
|
|
},
|
|
total: 0,
|
|
|
|
isAdd: null,
|
|
selectThis: null,
|
|
};
|
|
},
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
resetQuery() {
|
|
|
|
this.queryParams = {
|
|
|
|
};
|
|
|
|
this.getList();
|
|
},
|
|
handleDelete() {
|
|
this.$confirm("是否删除?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
let baMaterial = this.selectThis;
|
|
baMaterial.materialTypeCode = null;
|
|
baMaterial.materialTypeName = null;
|
|
baMaterial.materialTypeId = null;
|
|
let params = {
|
|
baMaterial,
|
|
};
|
|
this.$materiel.update(params).then((data) => {
|
|
if (data.data.code === 200) {
|
|
this.$message({
|
|
message: "删除成功",
|
|
type: "success",
|
|
});
|
|
this.getList();
|
|
} else {
|
|
this.$message({
|
|
message: "删除失败",
|
|
type: "error",
|
|
});
|
|
}
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
currentChange(val) {
|
|
this.selectThis = val;
|
|
if (val === null) {
|
|
this.buttonEnable = true;
|
|
} else {
|
|
this.buttonEnable = false;
|
|
}
|
|
},
|
|
|
|
AddHeader() {
|
|
this.$layer.iframe({
|
|
shadeClose: false,
|
|
content: {
|
|
content: selectMaterial, //传递的组件对象
|
|
parent: this, //当前的vue对象
|
|
shadeClose: false,
|
|
},
|
|
area: ["1050px", "620px"],
|
|
title: "选择产品信息(双击即可选中数据)",
|
|
});
|
|
},
|
|
getSelectMaterial(row) {
|
|
let aa = row;
|
|
aa.materialTypeCode = this.row.materialTypeCode;
|
|
aa.materialTypeName = this.row.materialTypeName;
|
|
aa.materialTypeId = this.row.id;
|
|
let parmas = {
|
|
baMaterial: aa,
|
|
};
|
|
this.$materiel.update(parmas).then((resp) => {
|
|
if (resp.data.code == 200) {
|
|
this.$message.success("新增成功!");
|
|
} else {
|
|
this.$message.success("新增成功!");
|
|
}
|
|
this.getList();
|
|
});
|
|
},
|
|
getList() {
|
|
let params = {
|
|
materialTypeCode: this.row.materialTypeCode,
|
|
pageSize: this.queryParams.pageSize,
|
|
pageNo: this.queryParams.pageNo,
|
|
materialName:this.queryParams.materialName,
|
|
materialCode:this.queryParams.materialCode,
|
|
};
|
|
this.$materiel.getMaterialList(params).then((resp) => {
|
|
if (resp.data.code == 200) {
|
|
this.total = resp.data.data.recordsTotal;
|
|
this.tableData = resp.data.data.data;
|
|
} else {
|
|
this.$message.error(resp.msg);
|
|
}
|
|
});
|
|
this.loading = false;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
>>> .el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
|
|
>>> .el-table__body tr.current-row > td {
|
|
background-color: #8ac1ff !important;
|
|
cursor: pointer;
|
|
}
|
|
|
|
>>> .el-table__body tr:hover > td {
|
|
background-color: #e9edf3 !important;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|