|
|
@@ -96,7 +96,7 @@
|
|
|
<span v-else>{{ row.nvSpecUnit }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="320">
|
|
|
<template slot-scope="{row}">
|
|
|
<template v-if="row.edit">
|
|
|
<el-button
|
|
|
@@ -116,6 +116,8 @@
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<el-button size="mini" type="primary" @click="row.edit=true">编辑</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="updateSort(row, 0)">上移</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="updateSort(row, 1)">下移</el-button>
|
|
|
<el-button size="mini" type="danger" @click="removeNutrient(row)">
|
|
|
删除
|
|
|
</el-button>
|
|
|
@@ -127,7 +129,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getNutrientList, addFoodNutrient, updateFoodNutrient, removeFoodNutrient } from '@/api/food'
|
|
|
+import { getNutrientList, addFoodNutrient, updateFoodNutrient, removeFoodNutrient,
|
|
|
+ updateFoodNutrientSort } from '@/api/food'
|
|
|
import { getList } from '@/api/nutrient'
|
|
|
import { getList as getUnits } from '@/api/unit'
|
|
|
|
|
|
@@ -212,6 +215,14 @@ export default {
|
|
|
res.data.list.forEach(item => units.push({ value: item.name }))
|
|
|
cb(units)
|
|
|
})
|
|
|
+ },
|
|
|
+ updateSort(row, type) {
|
|
|
+ updateFoodNutrientSort(this.foodId, row.nutrientId, { type }).then(res => {
|
|
|
+ this.$notify.success('提交成功')
|
|
|
+ this.fetchData()
|
|
|
+ }).catch(res => {
|
|
|
+ this.$message.error(res.data.message)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|