<template>
|
<el-dialog :title="title" :visible.sync="visible" width="1000px" @close="handleClose">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form-item label="物料编号" prop="materialCode">
|
<el-input
|
v-model="queryParams.materialCode"
|
placeholder="请输入物料编号"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="物料名称" prop="materialName">
|
<el-input
|
v-model="queryParams.materialName"
|
placeholder="请输入物料名称"
|
clearable
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item style="float: right">
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
</el-form-item>
|
</el-form>
|
<el-table border ref="multipleTable" v-loading="loading" :data="materialInfoList" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column :show-overflow-tooltip="true" label="物料编号" align="center" prop="materialCode" />
|
<el-table-column :show-overflow-tooltip="true" label="物料名称" align="center" prop="materialName" />
|
<el-table-column :show-overflow-tooltip="true" label="视图" align="center" prop="materialView" />
|
<el-table-column label="种类" align="center" prop="typeZ">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.type_z" :value="scope.row.typeZ"/>
|
</template>
|
</el-table-column>
|
<el-table-column label="类型" align="center" prop="typeL">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.type_l" :value="scope.row.typeL"/>
|
</template>
|
</el-table-column>
|
<el-table-column label="单位" align="center" prop="unit">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.unit" :value="scope.row.unit"/>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" label="版本" align="center" prop="version" />
|
<el-table-column label="状态" align="center" prop="status">
|
<template slot-scope="scope">
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
</template>
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" label="厂商" align="center" prop="supplier" />
|
<el-table-column :show-overflow-tooltip="true" label="备注" align="center" prop="remark" />
|
<el-table-column :show-overflow-tooltip="true" label="数据来源" align="center" prop="dataSource" />
|
<el-table-column :show-overflow-tooltip="true" label="创建用户" align="center" prop="createBy" />
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
</el-table-column>
|
<el-table-column :show-overflow-tooltip="true" label="更改用户" align="center" prop="updateBy" />
|
<el-table-column label="更改时间" align="center" prop="updateTime" width="180">
|
</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 @click="handleClose">取 消</el-button>
|
<el-button type="primary" @click="confirmSelection">确 定</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
|
<script>
|
import {listMaterialInfo} from "@/api/main/bs/materialInfo";
|
|
export default {
|
name: "ProductSelector",
|
dicts: ['sys_normal_disable', 'type_l', 'unit', 'type_z'],
|
props: {
|
visible: Boolean,
|
title: {
|
type: String,
|
default: "物料信息"
|
},
|
gridData: Array
|
},
|
data() {
|
return {
|
// 总条数
|
total: 0,
|
// 物料信息表格数据
|
materialInfoList: [],
|
// 遮罩层
|
loading: true,
|
showSearch: true,
|
multipleSelection: [],
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
materialCode: null,
|
materialName: null,
|
materialView: null,
|
typeZ: null,
|
typeL: null,
|
unit: null,
|
status: null,
|
},
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询物料信息列表 */
|
getList() {
|
this.loading = true;
|
listMaterialInfo(this.queryParams).then(response => {
|
this.materialInfoList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
handleClose() {
|
this.$emit('update:visible', false);
|
},
|
handleSelectionChange(selection) {
|
if (selection.length > 1) {
|
this.$refs.multipleTable.clearSelection();
|
this.$refs.multipleTable.toggleRowSelection(selection[selection.length - 1], true);
|
this.multipleSelection = [selection[selection.length - 1]];
|
} else {
|
this.multipleSelection = selection;
|
}
|
},
|
confirmSelection() {
|
if (this.multipleSelection.length > 0) {
|
this.$emit('select-product', this.multipleSelection[0]);
|
this.handleClose();
|
this.$refs.multipleTable.clearSelection();
|
} else {
|
this.$message({
|
message: '警告哦,未选择任何行',
|
type: 'warning'
|
});
|
}
|
}
|
}
|
};
|
</script>
|