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 path.resolve(this.basePath, routePath)
}
}
return this.basePath;
}
return path.resolve(this.basePath, routePath);
},
},
};
</script>

View File

@ -1,6 +1,10 @@
<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 }">
@ -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() {
return {
iswork:null
}
iswork: null,
};
},
created() {
this.iswork = setInterval(() => {
let toke = getToken()
let toke = getToken();
if (!toke || toke.length <= 0) return;
this.$axios.get('/admin/index/iswork').then(res=>{
this.$axios
.get("/admin/index/iswork")
.then((res) => {
if (res && res.data.new > 0) {
this.$notify({
title: '新的订单提醒',
title: "新的订单提醒",
duration: 0,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.new+')个新的订单,需要处理</strong>'
message:
"<strong>你有(" +
res.data.new +
")个新的订单,需要处理</strong>",
});
}
if (res && res.data.follow > 0) {
this.$notify({
title: '新的跟进提醒',
title: "新的跟进提醒",
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow+')个跟进订单,需要处理</strong>'
message:
"<strong>你有(" +
res.data.follow +
")个跟进订单,需要处理</strong>",
});
}
if (res && res.data.back > 0) {
this.$notify({
title: '转单申请',
title: "转单申请",
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.back+')个转单订单,需要处理</strong>'
message:
"<strong>你有(" +
res.data.back +
")个转单订单,需要处理</strong>",
});
}
if (res && res.data.order_write_off > 0) {
this.$notify({
title: '订单核销',
title: "订单核销",
duration: 10000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.order_write_off+')个核销订单</strong>'
message:
"<strong>你有(" +
res.data.order_write_off +
")个核销订单</strong>",
});
}
if (res && res.data.follow_message > 0) {
this.$notify({
// res.data.follow_order_id
title: '跟进提醒',
title: "跟进提醒",
duration: 50000,
dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow_message+')个跟进提醒</strong>',
onClick: this.followDetail(res.orderId)
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)
})
},3000);
.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,9 +155,9 @@ export default {
this.dialogVisible = true;
})
.catch((err) => {});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
@ -167,7 +196,7 @@ export default {
}
.hideSidebar .fixed-header {
width: calc(100% - 54px)
width: calc(100% - 54px);
}
.mobile .fixed-header {

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,
@ -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();
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,7 +772,7 @@ 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 },