|
|
@@ -1,55 +1,47 @@
|
|
|
<template>
|
|
|
<basic-container>
|
|
|
- <avue-crud :option="option"
|
|
|
- v-model:search="search"
|
|
|
- v-model:page="page"
|
|
|
- v-model="form"
|
|
|
- :table-loading="loading"
|
|
|
- :data="data"
|
|
|
- :permission="permissionList"
|
|
|
- :before-open="beforeOpen"
|
|
|
- ref="crud"
|
|
|
- @row-update="rowUpdate"
|
|
|
- @row-save="rowSave"
|
|
|
- @row-del="rowDel"
|
|
|
- @search-change="searchChange"
|
|
|
- @search-reset="searchReset"
|
|
|
- @selection-change="selectionChange"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @on-load="onLoad">
|
|
|
+ <avue-crud :option="option" v-model:search="search" v-model:page="page" v-model="form" :table-loading="loading" :data="data" :permission="permissionList" :before-open="beforeOpen" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
|
|
|
<template #menu-left>
|
|
|
- <el-button type="danger"
|
|
|
- icon="el-icon-delete"
|
|
|
- plain
|
|
|
- v-if="permission.famousLocation_delete"
|
|
|
- @click="handleDelete">删 除
|
|
|
- </el-button>
|
|
|
- <el-button type="warning"
|
|
|
- plain
|
|
|
- icon="el-icon-download"
|
|
|
- @click="handleExport">导 出
|
|
|
- </el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-plus" v-if="permission.famousLocation_add" @click="toEdit()">新增</el-button>
|
|
|
+ </template>
|
|
|
+ <template #menu="scope">
|
|
|
+ <el-button type="text" icon="el-icon-edit" v-if="permission.famousLocation_edit" @click="toEdit(scope.row)">编辑</el-button>
|
|
|
+ <el-button type="text" icon="el-icon-delete" v-if="permission.famousLocation_delete" @click="handleDelete(scope.row.id)">删 除</el-button>
|
|
|
+ </template>
|
|
|
+ <template #videos="scope">
|
|
|
+ <video v-if="scope.row.videos" :src="scope.row.videos" style="width: 200px; height: 112px; border: 1px dashed #d9d9d9" controls></video>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
+ <el-dialog :title="dialogTitle" fullscreen v-model="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" @close="closeDialog()" top="5vh" width="70%">
|
|
|
+ <edit-article v-if="dialogVisible" :id="currentArticle?currentArticle.id:''" @afterSave="afterSave" @toCancel="closeDialog" />
|
|
|
+ </el-dialog>
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {getList, getDetail, add, update, remove} from "@/api/ycwh/famousLocation";
|
|
|
+ import { getList, getDetail, add, update, remove } from "@/api/ycwh/famousLocation";
|
|
|
import option from "@/option/ycwh/famousLocation";
|
|
|
- import {mapGetters} from "vuex";
|
|
|
- import {exportBlob} from "@/api/common";
|
|
|
- import {getToken} from '@/utils/auth';
|
|
|
- import {downloadXls} from "@/utils/util";
|
|
|
- import {dateNow} from "@/utils/date";
|
|
|
+ import { mapGetters } from "vuex";
|
|
|
+ import { exportBlob } from "@/api/common";
|
|
|
+ import { getToken } from '@/utils/auth';
|
|
|
+ import { downloadXls } from "@/utils/util";
|
|
|
+ import { dateNow } from "@/utils/date";
|
|
|
import NProgress from 'nprogress';
|
|
|
import 'nprogress/nprogress.css';
|
|
|
+ //
|
|
|
+ import { getLazyTree } from "@/api/base/region";
|
|
|
+ import editArticle from "./components/editArticle/index.vue"
|
|
|
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ editArticle
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ dialogTitle: '',
|
|
|
+ currentArticle: null,
|
|
|
+ dialogVisible: false,
|
|
|
+ //
|
|
|
form: {},
|
|
|
query: {},
|
|
|
search: {},
|
|
|
@@ -82,7 +74,13 @@
|
|
|
return ids.join(",");
|
|
|
}
|
|
|
},
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
+ getRegionList() {
|
|
|
+ getLazyTree("4404").then(res => {
|
|
|
+ debugger
|
|
|
+ })
|
|
|
+ },
|
|
|
rowSave(row, done, loading) {
|
|
|
add(row).then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
@@ -111,10 +109,10 @@
|
|
|
},
|
|
|
rowDel(row) {
|
|
|
this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
.then(() => {
|
|
|
return remove(row.id);
|
|
|
})
|
|
|
@@ -127,15 +125,15 @@
|
|
|
});
|
|
|
},
|
|
|
handleDelete() {
|
|
|
- if (this.selectionList.length === 0) {
|
|
|
+ if(this.selectionList.length === 0) {
|
|
|
this.$message.warning("请选择至少一条数据");
|
|
|
return;
|
|
|
}
|
|
|
this.$confirm("确定将选择数据删除?", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
.then(() => {
|
|
|
return remove(this.ids);
|
|
|
})
|
|
|
@@ -149,11 +147,9 @@
|
|
|
});
|
|
|
},
|
|
|
handleExport() {
|
|
|
- let downloadUrl = `/famous_location/famousLocation/export-famousLocation?${this.website.tokenHeader}=${getToken()}`;
|
|
|
- const {
|
|
|
- } = this.query;
|
|
|
- let values = {
|
|
|
- };
|
|
|
+ let downloadUrl = `/famous_dish/famousLocation/export-famousLocation?${this.website.tokenHeader}=${getToken()}`;
|
|
|
+ const {} = this.query;
|
|
|
+ let values = {};
|
|
|
this.$confirm("是否导出数据?", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
@@ -161,13 +157,13 @@
|
|
|
}).then(() => {
|
|
|
NProgress.start();
|
|
|
exportBlob(downloadUrl, values).then(res => {
|
|
|
- downloadXls(res.data, `名点${dateNow()}.xlsx`);
|
|
|
+ downloadXls(res.data, `名菜${dateNow()}.xlsx`);
|
|
|
NProgress.done();
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
beforeOpen(done, type) {
|
|
|
- if (["edit", "view"].includes(type)) {
|
|
|
+ if(["edit", "view"].includes(type)) {
|
|
|
getDetail(this.form.id).then(res => {
|
|
|
this.form = res.data.data;
|
|
|
});
|
|
|
@@ -191,10 +187,10 @@
|
|
|
this.selectionList = [];
|
|
|
this.$refs.crud.toggleSelection();
|
|
|
},
|
|
|
- currentChange(currentPage){
|
|
|
+ currentChange(currentPage) {
|
|
|
this.page.currentPage = currentPage;
|
|
|
},
|
|
|
- sizeChange(pageSize){
|
|
|
+ sizeChange(pageSize) {
|
|
|
this.page.pageSize = pageSize;
|
|
|
},
|
|
|
refreshChange() {
|
|
|
@@ -203,11 +199,9 @@
|
|
|
onLoad(page, params = {}) {
|
|
|
this.loading = true;
|
|
|
|
|
|
- const {
|
|
|
- } = this.query;
|
|
|
+ const {} = this.query;
|
|
|
|
|
|
- let values = {
|
|
|
- };
|
|
|
+ let values = {};
|
|
|
|
|
|
getList(page.currentPage, page.pageSize, values).then(res => {
|
|
|
const data = res.data.data;
|
|
|
@@ -216,10 +210,29 @@
|
|
|
this.loading = false;
|
|
|
this.selectionClear();
|
|
|
});
|
|
|
+ },
|
|
|
+ // 新增文章相关
|
|
|
+ toEdit(row) {
|
|
|
+ if(row && row.id) {
|
|
|
+ this.dialogTitle += '编辑';
|
|
|
+ this.currentArticle = row;
|
|
|
+ } else {
|
|
|
+ this.dialogTitle += '新增'
|
|
|
+ this.currentArticle = null
|
|
|
+ }
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ closeDialog(needReflash) {
|
|
|
+ this.currentArticle = null;
|
|
|
+ if(needReflash) {
|
|
|
+ this.refreshChange();
|
|
|
+ }
|
|
|
+ this.dialogVisible = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-</style>
|
|
|
+
|
|
|
+</style>
|