|
|
@@ -5,10 +5,16 @@
|
|
|
<el-input
|
|
|
v-model="listQuery.query"
|
|
|
placeholder="请输入检索词"
|
|
|
- style="width: 60%;"
|
|
|
+ style="width: 40%;"
|
|
|
class="filter-item"
|
|
|
@keyup.enter.native="fetchData()"
|
|
|
/>
|
|
|
+ <el-select v-model="selectType" v-if="isUsda" clearable style="width: 160px;margin-left: 10px;" class="filter-item">
|
|
|
+ <el-option v-for="item in usdaTypes" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ <el-select v-model="selectType" v-if="foodSourceIsAll" clearable style="width: 160px;margin-left: 10px;" class="filter-item">
|
|
|
+ <el-option v-for="item in allTypes" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="fetchData">
|
|
|
检索
|
|
|
</el-button>
|
|
|
@@ -45,7 +51,7 @@
|
|
|
fit
|
|
|
highlight-current-row
|
|
|
style="width: 100%;"
|
|
|
- @row-click="handleFoodClick"
|
|
|
+ @row-dblclick="handleFoodClick"
|
|
|
>
|
|
|
<el-table-column type="index" label="序号" align="center" fixed width="60px" />
|
|
|
<el-table-column label="名称" align="center" fixed width="200px">
|
|
|
@@ -200,7 +206,7 @@ import Pagination from '@/components/Pagination'
|
|
|
import { getList, remove, copyFromSimilarFood } from '@/api/food'
|
|
|
import axios from 'axios'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
-import { getFoodSourceByUrl } from '@/utils/food-utils'
|
|
|
+import { getFoodSourceByUrl, isUsda } from '@/utils/food-utils'
|
|
|
import store from '@/store'
|
|
|
import VueQr from 'vue-qr'
|
|
|
|
|
|
@@ -235,7 +241,17 @@ export default {
|
|
|
params: {},
|
|
|
foodSource: '',
|
|
|
foodQRDialogVisible: false,
|
|
|
- foodQRParams: {}
|
|
|
+ foodQRParams: {},
|
|
|
+ isUsda: false,
|
|
|
+ foodSourceIsAll: false,
|
|
|
+ usdaTypes: [{ 'label': '全部', 'value': 'ALL' }, { 'label': 'Foundation', 'value': 'USDA_FOUNDATION' },
|
|
|
+ { 'label': 'SR Legacy', 'value': 'USDA_SR_LEGACY' }, { 'label': 'Branded', 'value': 'USDA_BRANDED' },
|
|
|
+ { 'label': 'FNDDS', 'value': 'USDA_FNDDS' }],
|
|
|
+ allTypes: [{ 'label': '全部', 'value': 'ALL' }, { 'label': '录入', 'value': 'ENTRY' },
|
|
|
+ { 'label': 'CFCT', 'value': 'CFCT' }, { 'label': 'Foundation', 'value': 'USDA_FOUNDATION' },
|
|
|
+ { 'label': 'SR Legacy', 'value': 'USDA_SR_LEGACY' }, { 'label': 'Branded', 'value': 'USDA_BRANDED' },
|
|
|
+ { 'label': 'FNDDS', 'value': 'USDA_FNDDS' }],
|
|
|
+ selectType: ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -245,12 +261,27 @@ export default {
|
|
|
} else {
|
|
|
this.listQuery.orderBy = 1
|
|
|
}
|
|
|
+ this.isUsda = isUsda(this.foodSource)
|
|
|
+ this.foodSourceIsAll = this.foodSource === ''
|
|
|
this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
fetchData() {
|
|
|
this.listLoading = true
|
|
|
this.listQuery.foodSource = this.foodSource
|
|
|
+ if (this.isUsda) {
|
|
|
+ if (!this.selectType || this.selectType === 'ALL'){
|
|
|
+ this.listQuery.foodSource = 'USDA'
|
|
|
+ } else {
|
|
|
+ this.listQuery.foodSource = this.selectType
|
|
|
+ }
|
|
|
+ } else if (this.foodSourceIsAll) {
|
|
|
+ if (!this.selectType || this.selectType === 'ALL') {
|
|
|
+ this.listQuery.foodSource = ''
|
|
|
+ } else {
|
|
|
+ this.listQuery.foodSource = this.selectType
|
|
|
+ }
|
|
|
+ }
|
|
|
getList(this.listQuery).then(response => {
|
|
|
this.list = response.data.list
|
|
|
this.total = response.data.count
|