Commit 650c003b authored by “yiyousong”'s avatar “yiyousong”

fix:修改设备管理页面

parent 600c48cf
...@@ -10,9 +10,10 @@ export default { ...@@ -10,9 +10,10 @@ export default {
return {}; return {};
}, },
created() { created() {
// this.readVueXData(); this.readVueXData();
}, },
methods: { methods: {
// 解决刷新store初始化问题
readVueXData() { readVueXData() {
window.addEventListener("beforeunload", () => { window.addEventListener("beforeunload", () => {
sessionStorage.setItem("store", JSON.stringify(this.$store.state)); sessionStorage.setItem("store", JSON.stringify(this.$store.state));
......
...@@ -113,15 +113,18 @@ ...@@ -113,15 +113,18 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
disabled disabled
class="tableScopeSwitch"
:active-value="1" :active-value="1"
:inactive-value="0" :inactive-value="0"
inactive-text="停用"
active-text="启用"
v-model="scope.row.enabled" v-model="scope.row.enabled"
@change="handleChange(scope.row)" @change="handleChange(scope.row)"
> >
</el-switch> </el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="150"> <!-- <el-table-column align="center" label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="flex jca"> <div class="flex jca">
<span <span
...@@ -144,7 +147,7 @@ ...@@ -144,7 +147,7 @@
> >
</div> </div>
</template> </template>
</el-table-column> </el-table-column> -->
</el-table> </el-table>
</div> </div>
<div class="pagination" v-if="total"> <div class="pagination" v-if="total">
...@@ -292,4 +295,27 @@ export default { ...@@ -292,4 +295,27 @@ export default {
.table-content { .table-content {
height: 550px; height: 550px;
} }
/deep/.tableScopeSwitch .el-switch__label {
position: absolute;
display: none;
color: #fff;
}
/*打开时文字位置设置*/
/deep/.tableScopeSwitch .el-switch__label--right {
z-index: 1;
left: 0px; /*不同场景下可能不同,自行调整*/
}
/*关闭时文字位置设置*/
/deep/.tableScopeSwitch .el-switch__label--left {
z-index: 1;
right: 0px; /*不同场景下可能不同,自行调整*/
}
/*显示文字*/
/deep/.tableScopeSwitch .el-switch__label.is-active {
display: block;
}
/deep/.tableScopeSwitch.el-switch .el-switch__core,
.el-switch .el-switch__label {
width: 60px !important; /*开关按钮的宽度大小*/
}
</style> </style>
\ No newline at end of file
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
...mapMutations(["SET_deptList"]), ...mapMutations(["SET_deptList"]),
// 计算面包屑 // 计算面包屑
calcBreads() { calcBreads() {
let temp = [{ to: "/", title: "数字样表系统" }]; let temp = [{ to: "/basicsset", title: "数字样表系统" }];
// 过滤出路由数据 // 过滤出路由数据
let r = this.$route.matched let r = this.$route.matched
.filter((v) => v.meta.title) .filter((v) => v.meta.title)
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
created() {}, created() {},
methods: { methods: {
handleGoHome() { handleGoHome() {
this.$router.push("/"); this.$router.push("/basicsset");
}, },
}, },
}; };
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<script> <script>
import { login } from "@/api/login"; import { login } from "@/api/login";
import local from "@/utils/local"; import local from "@/utils/local";
import { calcMenu } from "@/router";
export default { export default {
name: "login", name: "login",
data() { data() {
...@@ -63,6 +64,8 @@ export default { ...@@ -63,6 +64,8 @@ export default {
if (token) { if (token) {
local.setLocal("sampleToken", token); local.setLocal("sampleToken", token);
local.setLocal("sampleSiteId", siteid); local.setLocal("sampleSiteId", siteid);
// 渲染菜单
calcMenu();
this.$router.push("/basicsset"); this.$router.push("/basicsset");
} }
} }
......
...@@ -3,17 +3,26 @@ ...@@ -3,17 +3,26 @@
<el-dialog title="从公共库中选择" :visible.sync="Visible" width="50%"> <el-dialog title="从公共库中选择" :visible.sync="Visible" width="50%">
<TableHeader> <TableHeader>
<div slot="right" class="flex"> <div slot="right" class="flex">
<el-select v-model="department" size="small" placeholder="选择部门"> <el-select
v-model="department"
class="autoWidth"
size="small"
placeholder="选择部门"
>
<template slot="prefix">
{{ (deptList.find((s) => s.id === department) || {}).name }}
</template>
<el-option <el-option
v-for="item in options" v-for="item in deptList"
:key="item.value" :key="item.id"
:label="item.label" :label="item.name"
:value="item.value" :value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
<el-input <el-input
size="small" size="small"
style="width: 200px"
v-model="searchVal" v-model="searchVal"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入事项名称搜索" placeholder="请输入事项名称搜索"
...@@ -93,6 +102,7 @@ ...@@ -93,6 +102,7 @@
<script> <script>
import TableHeader from "@/components/TableHeader.vue"; import TableHeader from "@/components/TableHeader.vue";
import { mapGetters } from "vuex";
export default { export default {
components: { components: {
TableHeader, TableHeader,
...@@ -113,28 +123,6 @@ export default { ...@@ -113,28 +123,6 @@ export default {
}, },
data() { data() {
return { return {
options: [
{
value: "选项1",
label: "黄金糕",
},
{
value: "选项2",
label: "双皮奶",
},
{
value: "选项3",
label: "蚵仔煎",
},
{
value: "选项4",
label: "龙须面",
},
{
value: "选项5",
label: "北京烤鸭",
},
],
department: "", department: "",
searchVal: "", searchVal: "",
tableData: [ tableData: [
...@@ -172,6 +160,7 @@ export default { ...@@ -172,6 +160,7 @@ export default {
this.$emit("update:libVisible", val); this.$emit("update:libVisible", val);
}, },
}, },
...mapGetters(["deptList"]),
}, },
methods: { methods: {
handleOk() { handleOk() {
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="total" prop="total"
label="样表次数" label="填单次数"
align="center" align="center"
width="80" width="80"
> >
...@@ -182,6 +182,7 @@ ...@@ -182,6 +182,7 @@
</el-select> </el-select>
<el-input <el-input
size="small" size="small"
style="width: 200px"
v-model="rightSearch" v-model="rightSearch"
class="ml10 mr10" class="ml10 mr10"
placeholder="请输入事项名称搜索" placeholder="请输入事项名称搜索"
...@@ -457,7 +458,7 @@ export default { ...@@ -457,7 +458,7 @@ export default {
}, },
// 右边加入 // 右边加入
async handleJoin(id) { async handleJoin(id) {
let res = await createMatter({ ids: id,siteId:this.siteId }); let res = await createMatter({ ids: id, siteId: this.siteId });
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
......
import Vue from 'vue' import Vue from "vue";
import VueRouter from 'vue-router' import VueRouter from "vue-router";
import Layouts from "@/pages/layouts/Layouts.vue" import Layouts from "@/pages/layouts/Layouts.vue";
import store from '@/store' import store from "@/store";
// 解决重复点击同一个路由报错 // 解决重复点击同一个路由报错
const originalPush = VueRouter.prototype.push; const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (location) { VueRouter.prototype.push = function (location) {
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location).catch((err) => err);
} };
Vue.use(VueRouter) Vue.use(VueRouter);
const routes = [ const routes = [
{ {
path: '/jump', path: "/jump",
name: '跳转页', name: "跳转页",
component: () => import('@/pages/jump/jump') component: () => import("@/pages/jump/jump"),
}, },
{ {
path: '/', path: "/",
redirect: '/login', redirect: "/jump",
}, },
{ {
path: '/login', path: "/login",
name: '登录页', name: "登录页",
component: () => import('@/pages/login/login') component: () => import("@/pages/login/login"),
}, },
] ];
const router = new VueRouter({ const router = new VueRouter({
routes routes,
}) });
// 动态菜单 // 动态菜单
const dynamicRouter = [ const dynamicRouter = [
{ {
path: '/basicsset', path: "/basicsset",
component: Layouts, component: Layouts,
meta: { meta: {
icon: 'el-icon-setting', icon: "el-icon-setting",
title: '样表基础设置' title: "样表基础设置",
}, },
children: [ children: [
{ {
path: '', path: "",
// name: '样表基础设置', // name: '样表基础设置',
component: () => import('@/pages/software/basics/BasicsSet'), component: () => import("@/pages/software/basics/BasicsSet"),
},
} ],
]
}, },
{ {
path: '/mattermanage', path: "/mattermanage",
component: Layouts, component: Layouts,
meta: { meta: {
icon: 'el-icon-document', icon: "el-icon-document",
title: '样表事项管理' title: "样表事项管理",
}, },
children: [ children: [
{ {
path: '', path: "",
name: '样表事项管理', name: "样表事项管理",
component: () => import('@/pages/software/matter/MatterManage'), component: () => import("@/pages/software/matter/MatterManage"),
} },
] ],
}, },
{ {
path: '/materialsmanage', path: "/materialsmanage",
component: Layouts, component: Layouts,
meta: { meta: {
icon: 'el-icon-files', icon: "el-icon-files",
title: '样表管理' title: "样表管理",
}, },
children: [ children: [
{ {
path: '', path: "",
// name: '材料管理', // name: '材料管理',
component: () => import('@/pages/software/materials/MaterialsManage'), component: () => import("@/pages/software/materials/MaterialsManage"),
} },
] ],
}, },
{ {
path: '/librarymanage', path: "/librarymanage",
component: Layouts, component: Layouts,
meta: { meta: {
icon: 'el-icon-refrigerator', icon: "el-icon-refrigerator",
title: '公共库管理' title: "公共库管理",
}, },
children: [ children: [
{ {
path: '', path: "",
// name: '公共库管理', // name: '公共库管理',
component: () => import('@/pages/software/librarymanage/LibraryManage'), component: () => import("@/pages/software/librarymanage/LibraryManage"),
} },
] ],
}, },
{ {
path: '/numberwritedevice', path: "/numberwritedevice",
component: Layouts, component: Layouts,
meta: { meta: {
icon: 'el-icon-monitor', icon: "el-icon-monitor",
title: '数字样表设备' title: "数字样表设备",
}, },
children: [ children: [
{ {
path: '', path: "",
// name: '数字样表设备', // name: '数字样表设备',
component: () => import('@/pages/hardware/NumberWriteDevice'), component: () => import("@/pages/hardware/NumberWriteDevice"),
} },
] ],
}, },
] ];
// 过滤菜单 // 过滤菜单
function menusFilter(arr) { function menusFilter(arr) {
let router = arr.filter(v => { let router = arr.filter((v) => {
if (v.meta && v.meta.title) { if (v.meta && v.meta.title) {
if (v.children) { if (v.children) {
v.children = menusFilter(v.children) v.children = menusFilter(v.children);
} }
return v return v;
} }
}) });
return router return router;
} }
// 动态菜单 // 动态菜单
export function calcMenu() { export function calcMenu() {
dynamicRouter.forEach(v => { dynamicRouter.forEach((v) => {
router.addRoute(v) router.addRoute(v);
}) });
let menus = menusFilter(dynamicRouter) let menus = menusFilter(dynamicRouter);
store.commit('SET_MENUS',menus) store.commit("SET_MENUS", menus);
} }
calcMenu() calcMenu();
export default router export default router;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment