|
@@ -1,22 +1,22 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
- <el-button
|
|
|
|
|
- class="filter-item"
|
|
|
|
|
- style="margin-left: 10px;"
|
|
|
|
|
- type="primary"
|
|
|
|
|
- @click="handleCreateOrUpdate('create')"
|
|
|
|
|
- >
|
|
|
|
|
- 添加
|
|
|
|
|
- </el-button>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <div class="filter-container">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ class="filter-item"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="handleCreateOrUpdate('create')"
|
|
|
|
|
+ >
|
|
|
|
|
+ 添加
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
<el-table
|
|
<el-table
|
|
|
|
|
+ ref="dragTable"
|
|
|
:key="0"
|
|
:key="0"
|
|
|
v-loading="listLoading"
|
|
v-loading="listLoading"
|
|
|
:data="list"
|
|
:data="list"
|
|
|
border
|
|
border
|
|
|
fit
|
|
fit
|
|
|
highlight-current-row
|
|
highlight-current-row
|
|
|
- style="width: 60%;margin-top: 10px"
|
|
|
|
|
>
|
|
>
|
|
|
<el-table-column type="index" label="序号" align="center" width="60px" />
|
|
<el-table-column type="index" label="序号" align="center" width="60px" />
|
|
|
<el-table-column label="内容" align="center">
|
|
<el-table-column label="内容" align="center">
|
|
@@ -29,6 +29,11 @@
|
|
|
<el-image v-if="row.stepPic" style="width: 180px; height: 100px" :src="row.stepPic" fit="contain" />
|
|
<el-image v-if="row.stepPic" style="width: 180px; height: 100px" :src="row.stepPic" fit="contain" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <el-table-column align="center" label="Drag" width="80">
|
|
|
|
|
+ <template slot-scope="{}">
|
|
|
|
|
+ <svg-icon class="drag-handler" icon-class="drag" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding">
|
|
<el-table-column label="操作" align="center" class-name="small-padding">
|
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
|
<el-button size="mini" type="primary" @click="handleCreateOrUpdate('edit', row)">
|
|
<el-button size="mini" type="primary" @click="handleCreateOrUpdate('edit', row)">
|
|
@@ -69,6 +74,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import Sortable from 'sortablejs'
|
|
|
import SingleImage from '@/components/Upload/SingleImage'
|
|
import SingleImage from '@/components/Upload/SingleImage'
|
|
|
import { addRecipeStep, updateRecipeStep, removeRecipeStep, getRecipeSteps, updateRecipeStepSort } from '@/api/recipe'
|
|
import { addRecipeStep, updateRecipeStep, removeRecipeStep, getRecipeSteps, updateRecipeStepSort } from '@/api/recipe'
|
|
|
|
|
|
|
@@ -84,13 +90,27 @@ export default {
|
|
|
textMap: { 'create': '新建', 'edit': '更新' },
|
|
textMap: { 'create': '新建', 'edit': '更新' },
|
|
|
dialogStatus: '',
|
|
dialogStatus: '',
|
|
|
dialogFormVisible: false,
|
|
dialogFormVisible: false,
|
|
|
- rules: {}
|
|
|
|
|
|
|
+ rules: {},
|
|
|
|
|
+ sortable: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
this.recipeId = this.$route.params && this.$route.params.id
|
|
this.recipeId = this.$route.params && this.$route.params.id
|
|
|
this.fetchData()
|
|
this.fetchData()
|
|
|
},
|
|
},
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
|
|
|
|
+ this.sortable = Sortable.create(el, {
|
|
|
|
|
+ animation: 150,
|
|
|
|
|
+ ghostClass: 'sortable-ghost',
|
|
|
|
|
+ // ghostClass: 'sortable-ghost', // Class name for the drop placeholder,
|
|
|
|
|
+ setData: function(dataTransfer) {
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ onEnd: evt => {
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
fetchData() {
|
|
fetchData() {
|
|
|
this.listLoading = true
|
|
this.listLoading = true
|