This commit is contained in:
faiz 2024-08-19 19:48:02 +08:00
parent 195a076a37
commit 4f2bfadbfb
3 changed files with 218 additions and 154 deletions

View File

@ -1,16 +1,37 @@
<template>
<div v-if="!item.hidden">
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
<template
v-if="
hasOneShowingChild(item.children, item) &&
(!onlyOneChild.children || onlyOneChild.noShowingChildren) &&
!item.alwaysShow
"
>
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
<el-menu-item
:index="resolvePath(onlyOneChild.path)"
:class="{ 'submenu-title-noDropdown': !isNest }"
>
<item
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
:title="onlyOneChild.meta.title"
/>
</el-menu-item>
</app-link>
</template>
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
<el-submenu
v-else
ref="subMenu"
:index="resolvePath(item.path)"
popper-append-to-body
>
<template slot="title">
<item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
<item
v-if="item.meta"
:icon="item.meta && item.meta.icon"
:title="item.meta.title"
/>
</template>
<sidebar-item
v-for="child in item.children"
@ -25,71 +46,72 @@
</template>
<script>
import path from 'path'
import { isExternal } from '@/utils/validate'
import Item from './Item'
import AppLink from './Link'
import FixiOSBug from './FixiOSBug'
import path from "path";
import { isExternal } from "@/utils/validate";
import Item from "./Item";
import AppLink from "./Link";
import FixiOSBug from "./FixiOSBug";
export default {
name: 'SidebarItem',
name: "SidebarItem",
components: { Item, AppLink },
mixins: [FixiOSBug],
props: {
// route object
item: {
type: Object,
required: true
required: true,
},
isNest: {
type: Boolean,
default: false
default: false,
},
basePath: {
type: String,
default: ''
}
default: "",
},
},
data() {
// To fix https://github.com/PanJiaChen/vue-admin-template/issues/237
// TODO: refactor with render function
this.onlyOneChild = null
return {}
this.onlyOneChild = null;
return {};
},
methods: {
hasOneShowingChild(children = [], parent) {
const showingChildren = children.filter(item => {
const showingChildren = children.filter((item) => {
if (item.hidden) {
return false
return false;
} else {
// Temp set(will be used if only has one showing child)
this.onlyOneChild = item
return true
this.onlyOneChild = item;
return true;
}
})
});
// When there is only one child router, the child router is displayed by default
if (showingChildren.length === 1) {
return true
return true;
}
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
return true
this.onlyOneChild = { ...parent, path: "", noShowingChildren: true };
return true;
}
return false
return false;
},
resolvePath(routePath) {
routePath = routePath.replace(/\/:[a-zA-Z]+/g, "");
if (isExternal(routePath)) {
return routePath
return routePath;
}
if (isExternal(this.basePath)) {
return this.basePath
return this.basePath;
}
return path.resolve(this.basePath, routePath)
}
}
}
return path.resolve(this.basePath, routePath);
},
},
};
</script>

View File

@ -1,9 +1,13 @@
<template>
<div :class="classObj" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<div
v-if="device === 'mobile' && sidebar.opened"
class="drawer-bg"
@click="handleClickOutside"
/>
<sidebar class="sidebar-container" />
<div :class="{hasTagsView:needTagsView}" class="main-container">
<div :class="{'fixed-header':fixedHeader}">
<div :class="{ hasTagsView: needTagsView }" class="main-container">
<div :class="{ 'fixed-header': fixedHeader }">
<navbar />
<tags-view v-if="needTagsView" />
</div>
@ -16,104 +20,129 @@
</template>
<script>
import RightPanel from '@/components/RightPanel'
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components'
import ResizeMixin from './mixin/ResizeHandler'
import { mapState } from 'vuex'
import { getToken } from '@/utils/auth'
import RightPanel from "@/components/RightPanel";
import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
import ResizeMixin from "./mixin/ResizeHandler";
import { mapState } from "vuex";
import { getToken } from "@/utils/auth";
export default {
name: 'Layout',
name: "Layout",
components: {
AppMain,
Navbar,
RightPanel,
Settings,
Sidebar,
TagsView
TagsView,
},
mixins: [ResizeMixin],
computed: {
...mapState({
sidebar: state => state.app.sidebar,
device: state => state.app.device,
showSettings: state => state.settings.showSettings,
needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader
sidebar: (state) => state.app.sidebar,
device: (state) => state.app.device,
showSettings: (state) => state.settings.showSettings,
needTagsView: (state) => state.settings.tagsView,
fixedHeader: (state) => state.settings.fixedHeader,
}),
classObj() {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile'
}
}
mobile: this.device === "mobile",
};
},
},
data(){
data() {
return {
iswork:null
}
iswork: null,
};
},
created(){
this.iswork = setInterval(()=>{
let toke = getToken()
if(!toke || toke.length <= 0) return;
this.$axios.get('/admin/index/iswork').then(res=>{
if(res && res.data.new > 0) {
this.$notify({
title: '新的订单提醒',
duration: 0,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.new+')个新的订单,需要处理</strong>'
});
}
if(res && res.data.follow > 0) {
this.$notify({
title: '新的跟进提醒',
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow+')个跟进订单,需要处理</strong>'
});
}
if(res && res.data.back > 0) {
this.$notify({
title: '转单申请',
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.back+')个转单订单,需要处理</strong>'
});
}
if(res && res.data.order_write_off > 0) {
this.$notify({
title: '订单核销',
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.order_write_off+')个核销订单</strong>'
});
}
if(res && res.data.follow_message > 0) {
this.$notify({
// res.data.follow_order_id
title: '跟进提醒',
duration: 50000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow_message+')个跟进提醒</strong>',
onClick: this.followDetail(res.orderId)
});
}
}).catch(err=>{
console.log(err)
})
},3000);
created() {
this.iswork = setInterval(() => {
let toke = getToken();
if (!toke || toke.length <= 0) return;
this.$axios
.get("/admin/index/iswork")
.then((res) => {
if (res && res.data.new > 0) {
this.$notify({
title: "新的订单提醒",
duration: 0,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.new +
")个新的订单,需要处理</strong>",
});
}
if (res && res.data.follow > 0) {
this.$notify({
title: "新的跟进提醒",
duration: 10000,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.follow +
")个跟进订单,需要处理</strong>",
});
}
if (res && res.data.back > 0) {
this.$notify({
title: "转单申请",
duration: 10000,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.back +
")个转单订单,需要处理</strong>",
});
}
if (res && res.data.order_write_off > 0) {
this.$notify({
title: "订单核销",
duration: 10000,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.order_write_off +
")个核销订单</strong>",
});
}
if (res && res.data.follow_message > 0) {
this.$notify({
// res.data.follow_order_id
title: "跟进提醒",
duration: 50000,
dangerouslyUseHTMLString: true,
message:
"<strong>你有(" +
res.data.follow_message +
")个跟进提醒</strong>",
onClick: () => {
this.$router.push({
path: "/order/index/",
query: { id: res.data.follow_order_id },
});
},
});
}
})
.catch((err) => {
console.log(err);
});
}, 30000);
},
methods: {
handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
},
followDetail(orderId) {
},onInfo(item) {
console.log(orderId);
// this.$router.push({ path: "/order/index/" + orderId });
},
onInfo(item) {
this.value = null;
this.next_follow = null;
this.$set(item, "next_follow", null);
@ -126,51 +155,51 @@ export default {
this.dialogVisible = true;
})
.catch((err) => {});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
@import "~@/styles/mixin.scss";
@import "~@/styles/variables.scss";
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
width: 100%;
.app-wrapper {
@include clearfix;
position: relative;
height: 100%;
width: 100%;
&.mobile.openSidebar {
position: fixed;
top: 0;
}
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.fixed-header {
&.mobile.openSidebar {
position: fixed;
top: 0;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
}
.hideSidebar .fixed-header {
width: calc(100% - 54px)
}
.drawer-bg {
background: #000;
opacity: 0.3;
width: 100%;
top: 0;
height: 100%;
position: absolute;
z-index: 999;
}
.mobile .fixed-header {
width: 100%;
}
.fixed-header {
position: fixed;
top: 0;
right: 0;
z-index: 9;
width: calc(100% - #{$sideBarWidth});
transition: width 0.28s;
}
.hideSidebar .fixed-header {
width: calc(100% - 54px);
}
.mobile .fixed-header {
width: 100%;
}
</style>

View File

@ -181,7 +181,11 @@
<el-table-column align="center" fixed label="电话" width="140">
<template slot-scope="scope">
<span>{{ scope.row.mobile }}</span>
<span style="display:block;font-size: 12px;">{{ scope.row.mobileInfo.area }}-{{ scope.row.mobileInfo.originalIsp }}</span>
<span style="display: block; font-size: 12px"
>{{ scope.row.mobileInfo.area }}-{{
scope.row.mobileInfo.originalIsp
}}</span
>
</template>
</el-table-column>
@ -234,7 +238,7 @@
}"
type="primary"
>
{{ scope.row.appointment_status == 1 ? '已预约' : '未预约' }}
{{ scope.row.appointment_status == 1 ? "已预约" : "未预约" }}
</div>
</template>
</el-table-column>
@ -643,7 +647,7 @@ export default {
zhubo: null,
os_status: [],
},
item: { next_follow: "", personnel: {} },
item: { next_follow: "", personnel: { adult: "" } },
follow: [],
dialogVisible: false,
@ -657,7 +661,7 @@ export default {
flowObj: "",
os: null, // 12 3
},
os_arr: { 1: "美团", 2: "快手", 3: "抖音(甄选)", 5:"抖音(新国旅)" },
os_arr: { 1: "美团", 2: "快手", 3: "抖音(甄选)", 5: "抖音(新国旅)" },
adminList: [],
form: {},
rules: {
@ -673,19 +677,28 @@ export default {
if (this.$route.query.start && this.$route.query.end) {
this.listQuery.times = [this.$route.query.start, this.$route.query.end];
}
// console.log(typeof this.$route.params.id);
this.setQuery("status");
this.setQuery("os_status");
this.setQuery("times");
await this.getList();
await this.setOneClickRepair();
await this.getList();
if (!this.$route.query.id) {
await this.setOneClickRepair();
await this.getList();
}
this.getShortcutContent();
this.getAdminList();
},
mounted() {
console.log(this.$route.query.id);
if (this.$route.query.id) {
this.onInfo({ id: this.$route.query.id });
}
},
computed: {
tableMaxHeight() {
return window.innerHeight - 320 + 'px';
}
return window.innerHeight - 320 + "px";
},
},
methods: {
setQuery(key) {
@ -759,10 +772,10 @@ export default {
resetForm(formName) {
this.$refs[formName].resetFields();
},
getAdminList(typeDesc = '') {
getAdminList(typeDesc = "") {
this.$axios
.get("/admin/admin/index", {
params: { limit: 100, status: 1, is_order: 1, type_desc:typeDesc },
params: { limit: 100, status: 1, is_order: 1, type_desc: typeDesc },
})
.then((response) => {
this.adminList = response.data.data;