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

View File

@ -1,6 +1,10 @@
<template> <template>
<div :class="classObj" class="app-wrapper"> <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" /> <sidebar class="sidebar-container" />
<div :class="{ hasTagsView: needTagsView }" class="main-container"> <div :class="{ hasTagsView: needTagsView }" class="main-container">
<div :class="{ 'fixed-header': fixedHeader }"> <div :class="{ 'fixed-header': fixedHeader }">
@ -16,104 +20,129 @@
</template> </template>
<script> <script>
import RightPanel from '@/components/RightPanel' import RightPanel from "@/components/RightPanel";
import { AppMain, Navbar, Settings, Sidebar, TagsView } from './components' import { AppMain, Navbar, Settings, Sidebar, TagsView } from "./components";
import ResizeMixin from './mixin/ResizeHandler' import ResizeMixin from "./mixin/ResizeHandler";
import { mapState } from 'vuex' import { mapState } from "vuex";
import { getToken } from '@/utils/auth' import { getToken } from "@/utils/auth";
export default { export default {
name: 'Layout', name: "Layout",
components: { components: {
AppMain, AppMain,
Navbar, Navbar,
RightPanel, RightPanel,
Settings, Settings,
Sidebar, Sidebar,
TagsView TagsView,
}, },
mixins: [ResizeMixin], mixins: [ResizeMixin],
computed: { computed: {
...mapState({ ...mapState({
sidebar: state => state.app.sidebar, sidebar: (state) => state.app.sidebar,
device: state => state.app.device, device: (state) => state.app.device,
showSettings: state => state.settings.showSettings, showSettings: (state) => state.settings.showSettings,
needTagsView: state => state.settings.tagsView, needTagsView: (state) => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader fixedHeader: (state) => state.settings.fixedHeader,
}), }),
classObj() { classObj() {
return { return {
hideSidebar: !this.sidebar.opened, hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened, openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation, withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile' mobile: this.device === "mobile",
} };
} },
}, },
data() { data() {
return { return {
iswork:null iswork: null,
} };
}, },
created() { created() {
this.iswork = setInterval(() => { this.iswork = setInterval(() => {
let toke = getToken() let toke = getToken();
if (!toke || toke.length <= 0) return; 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) { if (res && res.data.new > 0) {
this.$notify({ this.$notify({
title: '新的订单提醒', title: "新的订单提醒",
duration: 0, duration: 0,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.new+')个新的订单,需要处理</strong>' message:
"<strong>你有(" +
res.data.new +
")个新的订单,需要处理</strong>",
}); });
} }
if (res && res.data.follow > 0) { if (res && res.data.follow > 0) {
this.$notify({ this.$notify({
title: '新的跟进提醒', title: "新的跟进提醒",
duration: 10000, duration: 10000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow+')个跟进订单,需要处理</strong>' message:
"<strong>你有(" +
res.data.follow +
")个跟进订单,需要处理</strong>",
}); });
} }
if (res && res.data.back > 0) { if (res && res.data.back > 0) {
this.$notify({ this.$notify({
title: '转单申请', title: "转单申请",
duration: 10000, duration: 10000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.back+')个转单订单,需要处理</strong>' message:
"<strong>你有(" +
res.data.back +
")个转单订单,需要处理</strong>",
}); });
} }
if (res && res.data.order_write_off > 0) { if (res && res.data.order_write_off > 0) {
this.$notify({ this.$notify({
title: '订单核销', title: "订单核销",
duration: 10000, duration: 10000,
dangerouslyUseHTMLString: true, 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) { if (res && res.data.follow_message > 0) {
this.$notify({ this.$notify({
// res.data.follow_order_id // res.data.follow_order_id
title: '跟进提醒', title: "跟进提醒",
duration: 50000, duration: 50000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: '<strong>你有('+res.data.follow_message+')个跟进提醒</strong>', message:
onClick: this.followDetail(res.orderId) "<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: { methods: {
handleClickOutside() { handleClickOutside() {
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
}, },
followDetail(orderId) { followDetail(orderId) {
console.log(orderId);
},onInfo(item) { // this.$router.push({ path: "/order/index/" + orderId });
},
onInfo(item) {
this.value = null; this.value = null;
this.next_follow = null; this.next_follow = null;
this.$set(item, "next_follow", null); this.$set(item, "next_follow", null);
@ -126,9 +155,9 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
}) })
.catch((err) => {}); .catch((err) => {});
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -167,7 +196,7 @@ export default {
} }
.hideSidebar .fixed-header { .hideSidebar .fixed-header {
width: calc(100% - 54px) width: calc(100% - 54px);
} }
.mobile .fixed-header { .mobile .fixed-header {

View File

@ -181,7 +181,11 @@
<el-table-column align="center" fixed label="电话" width="140"> <el-table-column align="center" fixed label="电话" width="140">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.mobile }}</span> <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> </template>
</el-table-column> </el-table-column>
@ -234,7 +238,7 @@
}" }"
type="primary" type="primary"
> >
{{ scope.row.appointment_status == 1 ? '已预约' : '未预约' }} {{ scope.row.appointment_status == 1 ? "已预约" : "未预约" }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -643,7 +647,7 @@ export default {
zhubo: null, zhubo: null,
os_status: [], os_status: [],
}, },
item: { next_follow: "", personnel: {} }, item: { next_follow: "", personnel: { adult: "" } },
follow: [], follow: [],
dialogVisible: false, dialogVisible: false,
@ -673,19 +677,28 @@ export default {
if (this.$route.query.start && this.$route.query.end) { if (this.$route.query.start && this.$route.query.end) {
this.listQuery.times = [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("status");
this.setQuery("os_status"); this.setQuery("os_status");
this.setQuery("times"); this.setQuery("times");
await this.getList(); await this.getList();
if (!this.$route.query.id) {
await this.setOneClickRepair(); await this.setOneClickRepair();
await this.getList(); await this.getList();
}
this.getShortcutContent(); this.getShortcutContent();
this.getAdminList(); this.getAdminList();
}, },
mounted() {
console.log(this.$route.query.id);
if (this.$route.query.id) {
this.onInfo({ id: this.$route.query.id });
}
},
computed: { computed: {
tableMaxHeight() { tableMaxHeight() {
return window.innerHeight - 320 + 'px'; return window.innerHeight - 320 + "px";
} },
}, },
methods: { methods: {
setQuery(key) { setQuery(key) {
@ -759,7 +772,7 @@ export default {
resetForm(formName) { resetForm(formName) {
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
}, },
getAdminList(typeDesc = '') { getAdminList(typeDesc = "") {
this.$axios this.$axios
.get("/admin/admin/index", { .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 },