|
|
@@ -10,6 +10,59 @@
|
|
|
:resizable="true"
|
|
|
>
|
|
|
<el-card shadow="never">
|
|
|
+ <el-form
|
|
|
+ size="small"
|
|
|
+ label-width="80px"
|
|
|
+ class="ele-form-search"
|
|
|
+ @keyup.enter.native="search"
|
|
|
+ @submit.native.prevent
|
|
|
+ >
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="编码">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ v-model.trim="where.productCode"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="名称">
|
|
|
+ <el-input
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ v-model.trim="where.productName"
|
|
|
+ placeholder="请输入"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" style="display: flex; justify-content: flex-end">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-search"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="search"
|
|
|
+ >
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ @click="search('reset')"
|
|
|
+ icon="el-icon-refresh"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ size="mini"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
+
|
|
|
+ <slot></slot>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="columns"
|
|
|
@@ -36,6 +89,10 @@
|
|
|
return {
|
|
|
visible: false,
|
|
|
datasource: [],
|
|
|
+ where: {
|
|
|
+ productCode: '',
|
|
|
+ productName: ''
|
|
|
+ },
|
|
|
columns: [
|
|
|
{
|
|
|
width: 45,
|
|
|
@@ -201,33 +258,50 @@
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
- selection: []
|
|
|
+ selection: [],
|
|
|
+ oldDatasource: []
|
|
|
};
|
|
|
},
|
|
|
|
|
|
watch: {},
|
|
|
methods: {
|
|
|
open(datasource) {
|
|
|
+ this.oldDatasource = datasource;
|
|
|
this.datasource = datasource || [];
|
|
|
this.visible = true;
|
|
|
},
|
|
|
-
|
|
|
+ search(type) {
|
|
|
+ if (type == 'reset') {
|
|
|
+ this.where = {
|
|
|
+ productName: '',
|
|
|
+ productCode: ''
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (this.where.productName == '' && this.where.productCode == '') {
|
|
|
+ this.datasource = this.oldDatasource;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.datasource = this.oldDatasource.filter((item) => {
|
|
|
+ if (
|
|
|
+ this.where.productName &&
|
|
|
+ item.productName.includes(this.where.productName)
|
|
|
+ ) {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ this.where.productCode &&
|
|
|
+ item.productCode.includes(this.where.productCode)
|
|
|
+ ) {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
selected() {
|
|
|
if (!this.selection.length) {
|
|
|
return this.$message.warning('请至少选择一条数据');
|
|
|
}
|
|
|
- // let idKey =
|
|
|
- // this.type == 'receive' ? 'receiveProductId' : 'sendProductId';
|
|
|
- // console.log(this.current);
|
|
|
- // console.log(this.currentData);
|
|
|
-
|
|
|
- // let index = this.currentData.findIndex(
|
|
|
- // (r) => r[idKey] == this.current.id
|
|
|
- // );
|
|
|
- // if (index != -1 && ['receive', 'send'].includes(this.type)) {
|
|
|
- // return this.$message.error('选择的产品已经存在列表了');
|
|
|
- // }
|
|
|
this.$emit('changeParent', this.selection);
|
|
|
+
|
|
|
this.visible = false;
|
|
|
}
|
|
|
}
|