This commit is contained in:
faiz 2024-09-02 18:03:02 +08:00
parent 9f05d996e7
commit 411f0d4b3a
3 changed files with 227 additions and 138 deletions

View File

@ -1,6 +1,11 @@
<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<hamburger
id="hamburger-container"
:is-active="sidebar.opened"
class="hamburger-container"
@toggleClick="toggleSideBar"
/>
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
@ -13,26 +18,54 @@
<el-tooltip content="Global Size" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> -->
</template>
<!-- <div class="right-menu-item hover-effect">
<el-button @click="drawer = true">QA常见问题</el-button>
</div>-->
<div v-if="$store.getters.is_anchor" class="right-menu-item hover-effect">
<el-button @click="dialogWorks = true">预约待处理10</el-button>
<div v-if="appointment_num" class="right-menu-item hover-effect">
<el-button style="color: red" @click="handleAppointemnet()"
>预约待处理({{ appointment_num }})</el-button
>
</div>
<div v-if="$store.getters.is_anchor" class="right-menu-item hover-effect">
<el-button @click="dialogWorks = true">排班{{ $store.getters.name }}</el-button>
<el-button @click="dialogWorks = true"
>排班{{ $store.getters.name }}</el-button
>
</div>
<div class="right-menu-item hover-effect">
<el-button :style="{backgroundColor:!workstatus?'#409EFF':'#fff',color:workstatus?'#979797':'#fff'}" @click="startWorks">{{ workstatus?'上班':'上班中' }}</el-button>
<el-button :style="{backgroundColor:workstatus?'#409EFF':'#fff',color:workstatus?'#fff':'#979797'}" @click="endWorks">{{ workstatus?'下班中':'下班' }}</el-button>
<el-button
:style="{
backgroundColor: !workstatus ? '#409EFF' : '#fff',
color: workstatus ? '#979797' : '#fff',
}"
@click="startWorks"
>{{ workstatus ? "上班" : "上班中" }}</el-button
>
<el-button
:style="{
backgroundColor: workstatus ? '#409EFF' : '#fff',
color: workstatus ? '#fff' : '#979797',
}"
@click="endWorks"
>{{ workstatus ? "下班中" : "下班" }}</el-button
>
</div>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<el-dropdown
class="avatar-container right-menu-item hover-effect"
trigger="click"
>
<div class="avatar-wrapper">
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar" alt="">
<i class="el-icon-camera" style="position: absolute;" @click.stop="showAvatar = true" />
<img
:src="avatar + '?imageView2/1/w/80/h/80'"
class="user-avatar"
alt=""
/>
<i
class="el-icon-camera"
style="position: absolute"
@click.stop="showAvatar = true"
/>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
@ -46,18 +79,12 @@
<el-dropdown-item>修改密码</el-dropdown-item>
</div>
<el-dropdown-item divided @click.native="logout">
<span style="display:block;">退出登录</span>
<span style="display: block">退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<el-dialog
title="提示"
:visible.sync="showAvatar"
width="30%"
center
>
<el-dialog title="提示" :visible.sync="showAvatar" width="30%" center>
<el-upload
class="avatar-uploader"
action="/admin/index/avatar"
@ -65,10 +92,9 @@
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="imageUrl" :src="imageUrl" class="avatar" alt="">
<img v-if="imageUrl" :src="imageUrl" class="avatar" alt="" />
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-dialog>
<el-dialog title="修改密码" :visible.sync="dialogPWD">
@ -88,7 +114,7 @@
<el-dialog title="排班" width="90%" :visible.sync="dialogWorks">
<el-form :rules="rules">
<el-row style="margin-bottom: 10px;">
<el-row style="margin-bottom: 10px">
<el-col :span="24">
<el-date-picker
v-model="times[0]"
@ -98,7 +124,7 @@
/>
</el-col>
</el-row>
<el-row style="margin-bottom: 10px;">
<el-row style="margin-bottom: 10px">
<el-col :span="24">
<el-date-picker
v-model="times[1]"
@ -108,10 +134,15 @@
/>
</el-col>
</el-row>
<el-row style="margin-bottom: 10px;">
<el-row style="margin-bottom: 10px">
<el-col :span="24">
<el-checkbox-group v-model="os">
<el-checkbox v-for="(v,i,k) in $store.getters.oss" :key="k" :label="i">{{ v }}</el-checkbox>
<el-checkbox
v-for="(v, i, k) in $store.getters.oss"
:key="k"
:label="i"
>{{ v }}</el-checkbox
>
</el-checkbox-group>
</el-col>
</el-row>
@ -129,10 +160,21 @@
:modal="false"
>
<div v-clickoutside="handleClose" class="drawer">
<el-button v-if="QaShow" type="success" @click="drawer = false"> </el-button>
<el-button v-if="!QaShow" type="success" @click="QaShow = true"> </el-button>
<el-button v-if="QaShow" type="success" @click="drawer = false"
> </el-button
>
<el-button v-if="!QaShow" type="success" @click="QaShow = true"
> </el-button
>
<div v-if="QaShow" class="mod">
<el-button v-for="item in getQaCityList" :key="item.city_id" style="width: 150px;" size="medium" type="primary" @click="clickQaList(item)">
<el-button
v-for="item in getQaCityList"
:key="item.city_id"
style="width: 150px"
size="medium"
type="primary"
@click="clickQaList(item)"
>
{{ item.city_name }}
</el-button>
</div>
@ -148,17 +190,17 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import { color } from 'echarts/lib/export'
import sidebar from '@/layout/components/Sidebar/index.vue'
import avatar from 'element-ui/packages/avatar'
import {getQaCityList, getQaList} from '@/api/qa'
import clickoutside from 'element-ui/src/utils/clickoutside'
import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from "@/components/Hamburger";
import Screenfull from "@/components/Screenfull";
import SizeSelect from "@/components/SizeSelect";
import Search from "@/components/HeaderSearch";
import { color } from "echarts/lib/export";
import sidebar from "@/layout/components/Sidebar/index.vue";
import avatar from "element-ui/packages/avatar";
import { getQaCityList, getQaList } from "@/api/qa";
import clickoutside from "element-ui/src/utils/clickoutside";
export default {
directives: { clickoutside },
components: {
@ -167,20 +209,22 @@ export default {
Screenfull,
SizeSelect,
// eslint-disable-next-line vue/no-unused-Wangeditor
Search
Search,
},
props: {
appointment_num: {
type: Number,
default: 0,
},
},
computed: {
avatar() {
return avatar
return avatar;
},
sidebar() {
return sidebar
return sidebar;
},
...mapGetters([
'sidebar',
'avatar',
'device'
])
...mapGetters(["sidebar", "avatar", "device"]),
},
// eslint-disable-next-line vue/order-in-Wangeditor
data() {
@ -198,112 +242,143 @@ export default {
getQaLists: [],
times: [],
form: {
oldpwd: '',
pwd: ''
oldpwd: "",
pwd: "",
},
QaInfo: {
title: '',
content: ''
title: "",
content: "",
},
rules: {
oldpwd: [
{ required: true, message: '请输入旧密码', trigger: 'blur' },
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
{ required: true, message: "请输入旧密码", trigger: "blur" },
{
min: 6,
max: 20,
message: "长度在 6 到 20 个字符",
trigger: "blur",
},
],
pwd: [
{ required: true, message: '请输入密码', trigger: 'blur' },
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
]
}
}
{ required: true, message: "请输入密码", trigger: "blur" },
{
min: 6,
max: 20,
message: "长度在 6 到 20 个字符",
trigger: "blur",
},
],
},
};
},
created() {
this.getworkstatus()
getQaCityList().then(res => {
this.getQaCityList = res.data
})
this.getworkstatus();
getQaCityList().then((res) => {
this.getQaCityList = res.data;
});
},
methods: {
color,
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
this.$store.dispatch("app/toggleSideBar");
},
handleClose() {
this.drawer = false
this.QaShow = true
this.drawer = false;
this.QaShow = true;
},
clickQaList(data) {
getQaList(data.city_id).then(res => {
this.getQaLists = res.data
})
console.log(JSON.stringify(this.getQaLists))
getQaList(data.city_id).then((res) => {
this.getQaLists = res.data;
});
console.log(JSON.stringify(this.getQaLists));
if (!this.getQaLists) {
return this.$message({
message: '暂无QA问题',
type: 'warning',
duration: 1500
})
message: "暂无QA问题",
type: "warning",
duration: 1500,
});
}
this.QaShow = false
this.QaShow = false;
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
await this.$store.dispatch("user/logout");
this.$router.push(`/login?redirect=${this.$route.fullPath}`);
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw)
this.imageUrl = URL.createObjectURL(file.raw);
},
pwd() {
this.$axios.post('/admin/admin/pwd', this.form).then(res => {
this.dialogPWD = false
this.form = {}
}).catch(err => {
console.log(err)
this.$axios
.post("/admin/admin/pwd", this.form)
.then((res) => {
this.dialogPWD = false;
this.form = {};
})
.catch((err) => {
console.log(err);
});
},
saveWork() {
this.$axios.post('/admin/work/save2', { times: this.times, os: this.os }).then(res => {
console.log(res)
this.$axios
.post("/admin/work/save2", { times: this.times, os: this.os })
.then((res) => {
console.log(res);
this.$message({
showClose: true,
message: '添加成功'
})
this.dialogWorks = false
}).catch(err => {
console.log(err)
message: "添加成功",
});
this.dialogWorks = false;
})
.catch((err) => {
console.log(err);
});
},
startWorks() {
this.$axios.post('/admin/admin/editInfo', { is_order: 1 }).then(res => {
console.log(res)
this.$axios
.post("/admin/admin/editInfo", { is_order: 1 })
.then((res) => {
console.log(res);
this.$message({
showClose: true,
message: '上班成功'
})
this.getworkstatus()
}).catch(err => {
console.log(err)
message: "上班成功",
});
this.getworkstatus();
})
.catch((err) => {
console.log(err);
});
},
endWorks() {
this.$axios.post('/admin/admin/editInfo', { is_order: 0 }).then(res => {
console.log(res)
this.$axios
.post("/admin/admin/editInfo", { is_order: 0 })
.then((res) => {
console.log(res);
this.$message({
showClose: true,
message: '下班成功'
})
this.getworkstatus()
}).catch(err => {
console.log(err)
message: "下班成功",
});
this.getworkstatus();
})
.catch((err) => {
console.log(err);
});
},
getworkstatus() {
this.$axios.post('/admin/work/getworkstatus', { id: this.id }).then(res => {
console.log(res)
this.workstatus = res.data
}).catch(err => {
console.log(err)
this.$axios
.post("/admin/work/getworkstatus", { id: this.id })
.then((res) => {
console.log(res);
this.workstatus = res.data;
})
.catch((err) => {
console.log(err);
});
},
handleAppointemnet() {
this.$router.push({
path: "/order/index/",
query: { appointment_status: "1", refresh: Date.now() },
});
},
beforeAvatarUpload(file) {
/*const isJPG = file.type === 'image/jpeg'
@ -316,9 +391,9 @@ export default {
this.$message.error('上传头像图片大小不能超过 2MB!')
}
return isJPG && isLt2M*/
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
@ -351,18 +426,18 @@ export default {
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
@ -394,10 +469,10 @@ export default {
&.hover-effect {
cursor: pointer;
transition: background .3s;
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, .025)
background: rgba(0, 0, 0, 0.025);
}
}
}
@ -436,7 +511,7 @@ export default {
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
border-color: #409eff;
}
.avatar-uploader-icon {
border: 1px solid #979797;

View File

@ -8,7 +8,7 @@
<sidebar class="sidebar-container" />
<div :class="{ hasTagsView: needTagsView }" class="main-container">
<div :class="{ 'fixed-header': fixedHeader }">
<navbar />
<navbar :appointment_num="appointment_num" />
<tags-view v-if="needTagsView" />
</div>
<app-main />
@ -57,6 +57,7 @@ export default {
data() {
return {
iswork: null,
appointment_num: 0,
};
},
created() {
@ -66,6 +67,11 @@ export default {
this.$axios
.get("/admin/index/iswork")
.then((res) => {
// console.log(res);
this.appointment_num = res.data.appointment_num;
console.log(this.appointment_num);
if (res && res.data.new > 0) {
this.$notify({
title: "新的订单提醒",
@ -133,7 +139,7 @@ export default {
.catch((err) => {
console.log(err);
});
}, 30000);
}, 3000);
},
methods: {
handleClickOutside() {

View File

@ -171,12 +171,13 @@
同步
</el-button>
<el-button v-if="scope.row.appointment_status == 1"
<el-button
v-if="scope.row.appointment_status == 1"
size="small"
icon="el-icon-edit"
@click="onOneClickYyHandle(scope.row)"
>
预约处理
预约处理
</el-button>
</el-button-group>
</template>
@ -249,7 +250,13 @@
}"
type="primary"
>
{{ scope.row.appointment_status == 1 ? "已预约(未处理)" : (scope.row.appointment_status == 2 ? "已预约(已处理)":"未预约") }}
{{
scope.row.appointment_status == 1
? "已预约(未处理)"
: scope.row.appointment_status == 2
? "已预约(已处理)"
: "未预约"
}}
</div>
</template>
</el-table-column>
@ -699,6 +706,7 @@ export default {
this.setQuery("status");
this.setQuery("os_status");
this.setQuery("times");
this.setQuery("appointment_status");
// await this.getList();
// if (!this.$route.query.id) {
// await this.setOneClickRepair();