|
@@ -1,83 +1,47 @@
|
|
|
<template>
|
|
|
- <div class="mod-category">
|
|
|
- <el-form :inline="true"
|
|
|
- :model="dataForm">
|
|
|
- <el-form-item>
|
|
|
- <el-button v-if="isAuth('prod:category:save')"
|
|
|
+ <div>
|
|
|
+
|
|
|
+ <avue-crud
|
|
|
+ ref="crud"
|
|
|
+ :page="page"
|
|
|
+ :data="dataList"
|
|
|
+ :table-loading="dataListLoading"
|
|
|
+ :option="tableOption"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope" slot="menuLeft" >
|
|
|
+ <el-button v-if="isAuth('prod:category:save')"
|
|
|
type="primary"
|
|
|
icon="el-icon-plus"
|
|
|
size="small"
|
|
|
@click="addOrUpdateHandle()">新增</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <el-table :data="dataList"
|
|
|
- border
|
|
|
- row-key="categoryId"
|
|
|
- style="width: 100%;">
|
|
|
-
|
|
|
- <el-table-column prop="categoryId"
|
|
|
- header-align="left"
|
|
|
- treeKey="categoryId"
|
|
|
- width="150"
|
|
|
- label="#">
|
|
|
- </el-table-column>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot-scope="scope" slot="status">
|
|
|
+ <el-tag v-if="scope.row.status === 1" size="small" type="success">正常</el-tag>
|
|
|
+ <el-tag v-else size="small" type="warning">下线</el-tag>
|
|
|
+ </template>
|
|
|
|
|
|
- <el-table-column prop="categoryName"
|
|
|
- header-align="center"
|
|
|
- width="150"
|
|
|
- label="分类名称">
|
|
|
- </el-table-column>
|
|
|
- <!--el-table-column prop="pic"
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- label="图片">
|
|
|
- <template slot-scope="scope">
|
|
|
- <img :src="resourcesUrl + scope.row.pic " />
|
|
|
- </template>
|
|
|
- </el-table-column-->
|
|
|
- <el-table-column prop="status"
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- label="状态">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tag v-if="scope.row.status === 0"
|
|
|
+ <template slot-scope="scope" slot="menu">
|
|
|
+ <el-button v-if="isAuth('prod:category:update')"
|
|
|
+ type="primary"
|
|
|
size="small"
|
|
|
- type="danger">下线</el-tag>
|
|
|
- <el-tag v-else
|
|
|
- size="small">正常</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="seq"
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- label="优先级">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- header-align="center"
|
|
|
- align="center"
|
|
|
- label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button v-if="isAuth('prod:category:update')"
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- @click="addOrUpdateHandle(scope.row.categoryId)">修改</el-button>
|
|
|
- <el-button v-if="isAuth('prod:category:delete')"
|
|
|
- type="danger"
|
|
|
- size="small"
|
|
|
- @click="deleteHandle(scope.row.categoryId)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <!-- 弹窗, 新增 / 修改 -->
|
|
|
- <add-or-update v-if="addOrUpdateVisible"
|
|
|
- ref="addOrUpdate"
|
|
|
- @refreshDataList="getDataList"></add-or-update>
|
|
|
- </div>
|
|
|
+ @click="addOrUpdateHandle(scope.row.categoryId)">修改</el-button>
|
|
|
+ <el-button v-if="isAuth('prod:category:delete')"
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="deleteHandle(scope.row.categoryId)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ <!-- 弹窗, 新增 / 修改 -->
|
|
|
+ <add-or-update v-if="addOrUpdateVisible"
|
|
|
+ ref="addOrUpdate"
|
|
|
+ @refreshDataList="getDataList"></add-or-update>
|
|
|
+</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import AddOrUpdate from './category-add-or-update'
|
|
|
-import { treeDataTranslate } from '@/utils'
|
|
|
+import { tableOption } from '@/crud/prod/category'
|
|
|
|
|
|
export default {
|
|
|
data () {
|
|
@@ -86,7 +50,8 @@ export default {
|
|
|
dataList: [],
|
|
|
dataListLoading: false,
|
|
|
addOrUpdateVisible: false,
|
|
|
- resourcesUrl: process.env.VUE_APP_RESOURCES_URL
|
|
|
+ resourcesUrl: process.env.VUE_APP_RESOURCES_URL,
|
|
|
+ tableOption
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -105,7 +70,7 @@ export default {
|
|
|
params: this.$http.adornParams()
|
|
|
}).then(({ data }) => {
|
|
|
// this.dataList = treeDataTranslate(data, 'categoryId', 'parentId')
|
|
|
- this.dataList = treeDataTranslate(data, 'parentId')
|
|
|
+ this.dataList = data
|
|
|
this.dataListLoading = false
|
|
|
})
|
|
|
},
|