|
@@ -1,3 +1,4 @@
|
|
|
+<!-- 场景专区 -->
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<!-- 列表 -->
|
|
@@ -10,18 +11,43 @@
|
|
|
<el-image :src="scope.row.pic" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="当前状态" prop="status" align="center" :formatter="statusFormatter" />
|
|
|
+ <el-table-column
|
|
|
+ label="当前状态"
|
|
|
+ prop="status"
|
|
|
+ align="center"
|
|
|
+ :formatter="statusFormatter"
|
|
|
+ />
|
|
|
<el-table-column label="操作" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" @click="getDetail(scope.row.id, true)">查看</el-button>
|
|
|
- <el-button v-if="scope.row.status === 0" type="text" @click="getChange(scope.row, 1, '下架')"
|
|
|
- v-hasPermi="['operation:scene:down']">下架</el-button>
|
|
|
+ <el-button type="text" @click="getDetail(scope.row.id, true)"
|
|
|
+ >查看</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-if="scope.row.status === 0"
|
|
|
+ type="text"
|
|
|
+ @click="getChange(scope.row, 1, '下架')"
|
|
|
+ v-hasPermi="['operation:scene:down']"
|
|
|
+ >下架</el-button
|
|
|
+ >
|
|
|
<span v-else style="margin-left: 10px">
|
|
|
- <el-button type="text" @click="getDetail(scope.row.id)" v-hasPermi="['operation:scene:edit']">编辑</el-button>
|
|
|
- <el-button type="text" @click="getChange(scope.row, 0, '上架')"
|
|
|
- v-hasPermi="['operation:scene:up']">上架</el-button>
|
|
|
- <el-button type="delete" @click="getChange(scope.row, 2, '删除')"
|
|
|
- v-hasPermi="['operation:scene:delete']">删除</el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="getDetail(scope.row.id)"
|
|
|
+ v-hasPermi="['operation:scene:edit']"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ @click="getChange(scope.row, 0, '上架')"
|
|
|
+ v-hasPermi="['operation:scene:up']"
|
|
|
+ >上架</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="delete"
|
|
|
+ @click="getDelete(scope.row, 2, '删除')"
|
|
|
+ v-hasPermi="['operation:scene:delete']"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -30,8 +56,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { list, change } from '@/api/operation/scene'
|
|
|
-import { disabledMixin } from '@/mixin/index'
|
|
|
+import { change, list } from "@/api/operation/scene";
|
|
|
+import { disabledMixin } from "@/mixin/index";
|
|
|
+import { dialogCallBack } from "@/utils/DialogUtil";
|
|
|
export default {
|
|
|
mixins: [disabledMixin],
|
|
|
data() {
|
|
@@ -39,57 +66,78 @@ export default {
|
|
|
// 遮罩层
|
|
|
loading: false,
|
|
|
// 列表
|
|
|
- tableData: []
|
|
|
- }
|
|
|
+ tableData: [],
|
|
|
+ };
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 列表
|
|
|
getList() {
|
|
|
- this.loading = true
|
|
|
- list().then(res => {
|
|
|
+ this.loading = true;
|
|
|
+ list().then((res) => {
|
|
|
if (res.code === 0) {
|
|
|
- this.tableData = res.data
|
|
|
- this.loading = false
|
|
|
+ this.tableData = res.data;
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 详情
|
|
|
getDetail(id, boolean) {
|
|
|
this.$router.push({
|
|
|
- path: '/operation/scene/detail',
|
|
|
+ path: "/operation/scene/detail",
|
|
|
query: {
|
|
|
id: id,
|
|
|
- boolean: boolean
|
|
|
- }
|
|
|
- })
|
|
|
+ boolean: boolean,
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 上下架
|
|
|
getChange(row, status, title) {
|
|
|
- this.$confirm(`是否${title}${row.name}?`, '提示', {
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- change(row.id, 1, status).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$message.success(`${title}成功!`)
|
|
|
- this.getList()
|
|
|
- }
|
|
|
+ this.$confirm(`是否${title}${row.name}?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ change(row.id, 1, status).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$message.success(`${title}成功!`);
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
})
|
|
|
- }).catch(() => { })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+
|
|
|
+ // 删除
|
|
|
+ getDelete(row, status, title) {
|
|
|
+ var that = this;
|
|
|
+ dialogCallBack(that, function () {
|
|
|
+ that
|
|
|
+ .$confirm(`是否${title}${row.name}?`, "提示", {
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ change(row.id, 1, status).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ that.$message.success(`${title}成功!`);
|
|
|
+ that.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 字典翻译
|
|
|
statusFormatter(row) {
|
|
|
- return this.selectDictLabel(this.disabledOptions, row.status)
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ return this.selectDictLabel(this.disabledOptions, row.status);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
</style>
|