|
@@ -38,7 +38,49 @@
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <el-col :span="6" style="display: flex; justify-content: flex-end">
|
|
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item label="批次号">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-model.trim="where.batchNo"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item label="型号">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-model.trim="where.modelType"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ <el-row :gutter="10">
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item label="规格">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-model.trim="where.specification"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item label="颜色">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ v-model.trim="where.colorKey"
|
|
|
|
|
+ placeholder="请输入"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="12" style="display: flex; justify-content: flex-end">
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button
|
|
<el-button
|
|
|
size="mini"
|
|
size="mini"
|
|
@@ -91,7 +133,11 @@
|
|
|
datasource: [],
|
|
datasource: [],
|
|
|
where: {
|
|
where: {
|
|
|
productCode: '',
|
|
productCode: '',
|
|
|
- productName: ''
|
|
|
|
|
|
|
+ productName: '',
|
|
|
|
|
+ batchNo: '',
|
|
|
|
|
+ modelType: '',
|
|
|
|
|
+ specification: '',
|
|
|
|
|
+ colorKey: ''
|
|
|
},
|
|
},
|
|
|
columns: [
|
|
columns: [
|
|
|
{
|
|
{
|
|
@@ -266,32 +312,47 @@
|
|
|
open(datasource) {
|
|
open(datasource) {
|
|
|
this.oldDatasource = datasource;
|
|
this.oldDatasource = datasource;
|
|
|
this.datasource = datasource || [];
|
|
this.datasource = datasource || [];
|
|
|
|
|
+ // 每次打开清空上次查询条件
|
|
|
|
|
+ this.where = {
|
|
|
|
|
+ productCode: '',
|
|
|
|
|
+ productName: '',
|
|
|
|
|
+ batchNo: '',
|
|
|
|
|
+ modelType: '',
|
|
|
|
|
+ specification: '',
|
|
|
|
|
+ colorKey: ''
|
|
|
|
|
+ };
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
},
|
|
},
|
|
|
search(type) {
|
|
search(type) {
|
|
|
if (type == 'reset') {
|
|
if (type == 'reset') {
|
|
|
this.where = {
|
|
this.where = {
|
|
|
|
|
+ productCode: '',
|
|
|
productName: '',
|
|
productName: '',
|
|
|
- productCode: ''
|
|
|
|
|
|
|
+ batchNo: '',
|
|
|
|
|
+ modelType: '',
|
|
|
|
|
+ specification: '',
|
|
|
|
|
+ colorKey: ''
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
- if (this.where.productName == '' && this.where.productCode == '') {
|
|
|
|
|
|
|
+ // 所有条件都为空时显示全部
|
|
|
|
|
+ const allEmpty = Object.keys(this.where).every((key) => !this.where[key]);
|
|
|
|
|
+ if (allEmpty) {
|
|
|
this.datasource = this.oldDatasource;
|
|
this.datasource = this.oldDatasource;
|
|
|
- return
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ // 多条件同时满足(AND),字段值包含关键字即匹配,空条件忽略
|
|
|
this.datasource = this.oldDatasource.filter((item) => {
|
|
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;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const match = (value, keyword) =>
|
|
|
|
|
+ !keyword ||
|
|
|
|
|
+ (value != null && String(value).includes(keyword));
|
|
|
|
|
+ return (
|
|
|
|
|
+ match(item.productName, this.where.productName) &&
|
|
|
|
|
+ match(item.productCode, this.where.productCode) &&
|
|
|
|
|
+ match(item.batchNo, this.where.batchNo) &&
|
|
|
|
|
+ match(item.modelType, this.where.modelType) &&
|
|
|
|
|
+ match(item.specification, this.where.specification) &&
|
|
|
|
|
+ match(item.colorKey, this.where.colorKey)
|
|
|
|
|
+ );
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
selected() {
|
|
selected() {
|