|
|
|
@ -0,0 +1,224 @@
|
|
|
|
|
<template>
|
|
|
|
|
<el-dialog title="BOM物料选择"
|
|
|
|
|
v-if="showFlag"
|
|
|
|
|
:visible.sync="showFlag"
|
|
|
|
|
:modal= false
|
|
|
|
|
width="1000px"
|
|
|
|
|
>
|
|
|
|
|
<el-tabs type="border-card" v-model="activeName">
|
|
|
|
|
<el-tab-pane label="物料选择" name="first">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<!--BOM数据-->
|
|
|
|
|
<el-col :span="24" :xs="24">
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="105px" align="center">
|
|
|
|
|
<el-form-item label="物料编码" prop="itemCode">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.component"
|
|
|
|
|
placeholder="请输入物料编码"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="物料名称" prop="itemName">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.componentName"
|
|
|
|
|
placeholder="请输入物料名称"
|
|
|
|
|
clearable
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
@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="handleBomSelectionChange" ref="myTable" >
|
|
|
|
|
<el-table-column width="50" align="center" type="selection">
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- 序号 -->
|
|
|
|
|
<el-table-column type="index" width="90" align="center" :index="indexMethod" label="序号"></el-table-column>
|
|
|
|
|
<el-table-column label="BOM物料组件编码" align="left" key="component" prop="component" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
|
|
|
|
<el-table-column label="BOM物料组件名称" align="left" key="componentName" prop="componentName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<pagination
|
|
|
|
|
v-show="total>0"
|
|
|
|
|
:total="total"
|
|
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="导入物料" name="second">
|
|
|
|
|
<el-upload
|
|
|
|
|
ref="upload"
|
|
|
|
|
:limit="1"
|
|
|
|
|
accept=".xlsx, .xls"
|
|
|
|
|
:headers="upload.headers"
|
|
|
|
|
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
|
|
|
:disabled="upload.isUploading"
|
|
|
|
|
:on-progress="handleFileUploadProgress"
|
|
|
|
|
:on-success="handleFileSuccess"
|
|
|
|
|
:auto-upload="false"
|
|
|
|
|
drag
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-upload"></i>
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
<div class="el-upload__tip text-center" slot="tip">
|
|
|
|
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
|
|
|
|
@click="importTemplate">下载模板
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button type="primary" @click="submitBomForm" v-if="this.activeName == 'first'">确 定</el-button>
|
|
|
|
|
<el-button type="primary" @click="submitFileForm" v-if="this.activeName == 'second'">确 定</el-button>
|
|
|
|
|
<el-button @click="showFlag=false">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
import {getQcListBom } from "@/api/quality/income";
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
export default {
|
|
|
|
|
name: "itemSelectMaterial",
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showFlag:false,
|
|
|
|
|
// 选中数组
|
|
|
|
|
selectedRows: {},
|
|
|
|
|
// 非单个禁用
|
|
|
|
|
single: true,
|
|
|
|
|
// 非多个禁用
|
|
|
|
|
multiple: false,
|
|
|
|
|
// 显示搜索条件
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 总条数
|
|
|
|
|
total: 0,
|
|
|
|
|
// BOM产品表格数据
|
|
|
|
|
itemList: null,
|
|
|
|
|
//树名称
|
|
|
|
|
bomCode: undefined,
|
|
|
|
|
defaultProps: {
|
|
|
|
|
id: "id",
|
|
|
|
|
label: "label"
|
|
|
|
|
},
|
|
|
|
|
// 查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
component: '',
|
|
|
|
|
componentName : ''
|
|
|
|
|
},
|
|
|
|
|
// 列信息
|
|
|
|
|
columns: [
|
|
|
|
|
{ key: 0, label: `BOM物料编码`, visible: true },
|
|
|
|
|
{ key: 1, label: `产品名称`, visible: true },
|
|
|
|
|
{ key: 2, label: `BOM物料组件编码`, visible: true },
|
|
|
|
|
{ key: 3, label: `BOM物料组件名称`, visible: true }
|
|
|
|
|
],
|
|
|
|
|
// 导入数据
|
|
|
|
|
activeName: 'first',
|
|
|
|
|
upload: {
|
|
|
|
|
// 是否禁用上传
|
|
|
|
|
isUploading: false,
|
|
|
|
|
// 是否更新已经存在的用户数据
|
|
|
|
|
updateSupport: 0,
|
|
|
|
|
// 设置上传的请求头部
|
|
|
|
|
headers: {poolName: localStorage.getItem("USER_POOL_NAME_CURRENT"), Authorization: "Bearer " + getToken()},
|
|
|
|
|
// 上传的地址
|
|
|
|
|
url: process.env.VUE_APP_BASE_API + "/quality/checkTypeProject/importData"
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
handleEquipmentSelectionChange (val) {
|
|
|
|
|
this.itemList = val
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 查询BOM列表*/
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.queryParams.bomCode = this.queryParams.itemCode;
|
|
|
|
|
this.queryParams.productDescZh = this.queryParams.itemName;
|
|
|
|
|
getQcListBom(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();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 多选框选中数据
|
|
|
|
|
handleBomSelectionChange(selection) {
|
|
|
|
|
if(selection.length>1){
|
|
|
|
|
this.$modal.msgSuccess("只能选一个");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ids = selection[0].component;
|
|
|
|
|
this.idsName = selection[0].componentName;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
submitBomForm() {
|
|
|
|
|
this.selectedRows.code = this.ids;
|
|
|
|
|
this.selectedRows.name = this.idsName;
|
|
|
|
|
this.$emit('onSelected', this.selectedRows);
|
|
|
|
|
this.showFlag = false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 导入-文件上传中处理
|
|
|
|
|
handleFileUploadProgress(event, file, fileList) {
|
|
|
|
|
this.upload.isUploading = true;
|
|
|
|
|
},
|
|
|
|
|
// 导入-文件上传成功处理
|
|
|
|
|
handleFileSuccess(response, file, fileList) {
|
|
|
|
|
this.showFlag = false;
|
|
|
|
|
this.upload.isUploading = false;
|
|
|
|
|
this.$refs.upload.clearFiles();
|
|
|
|
|
this.$emit('onSelected', []);
|
|
|
|
|
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
// 导入-提交上传文件
|
|
|
|
|
submitFileForm() {
|
|
|
|
|
this.$refs.upload.submit().then();
|
|
|
|
|
|
|
|
|
|
this.showFlag = false;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 导入-下载模板
|
|
|
|
|
importTemplate() {
|
|
|
|
|
this.download('/quality/checkTypeProject/importMaterailTemplate', {}, `qua_import_template_${new Date().getTime()}.xlsx`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|