From 8f03059619b5a5e9574b71d2ada27b76db2ffd7a Mon Sep 17 00:00:00 2001 From: Admin <978517621@qq.com> Date: 星期五, 18 十一月 2022 16:48:28 +0800 Subject: [PATCH] 新增 --- src/views/specialCheck/index.vue | 96 ++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 76 insertions(+), 20 deletions(-) diff --git a/src/views/specialCheck/index.vue b/src/views/specialCheck/index.vue index ee63d9f..135ca32 100644 --- a/src/views/specialCheck/index.vue +++ b/src/views/specialCheck/index.vue @@ -1,19 +1,19 @@ <template> <div class="app-container" style="padding-bottom:40px"> <div class="menu-area"> - <el-button class="add-btn" type="primary" icon="el-icon-plus" @click="sendJob()">新任务下发</el-button> -<!-- <div class="menu-tit">2023年上半年安全检查</div>--> + <el-button v-if="unitType==1" class="add-btn" type="primary" icon="el-icon-plus" @click="sendJob()">新任务下发</el-button> <el-menu default-active="1" class="el-menu-vertical-demo" background-color="#eeeeee" text-color="#333" + unique-opened active-text-color="#034EA2" @select="menuSelect"> - <el-submenu index="1"> + <el-submenu v-for="(item,i) in taskMenu" :key="i" :index="item.id + ''"> <template slot="title"> <i class="el-icon-s-order"></i> - <span>2023年上半年安全检查</span> + <span>{{item.taskName}}</span> </template> <el-menu-item index="1"> <span slot="title">安全检查反馈情况(批发)</span> @@ -21,15 +21,15 @@ <el-menu-item index="2"> <span slot="title">安全检查反馈情况(零售)</span> </el-menu-item> - <el-menu-item index="3"> + <el-menu-item index="3" v-if="unitType==1||unitType==2"> <span slot="title">安全检查情况汇总</span> </el-menu-item> </el-submenu> </el-menu> </div> <div class="table-area"> - <wholesale-form v-show="curTab == 1"></wholesale-form> - <retail-form v-show="curTab == 2"></retail-form> + <wholesale-form v-show="curTab == 1 || curTab == 2" ref="wholesale"></wholesale-form> + <sum-sheet v-show="curTab == 3" ref="sumSheet"></sum-sheet> </div> <send-work ref="send"></send-work> </div> @@ -42,23 +42,29 @@ import {MessageBox} from 'element-ui' import { getToken } from '@/utils/auth' import wholesaleForm from './components/wholesaleForm' - import retailForm from "./components/retailForm" + import sumSheet from "./components/sumSheet" import sendWork from "./components/sendWork" + import { getCheckUnitType, getSpecialCheckTask } from "@/api/specialCheck" export default { name: "specialCheck", components:{ wholesaleForm, - retailForm, + sumSheet, sendWork }, data() { return { - curTab: 1 + curTab: 1, + unitType: 1, + taskMenu: [], + taskId: null } }, created() { - + const t = this + t.getCheckUnitType() + t.getSpecialCheckTask() }, mounted() { @@ -70,9 +76,51 @@ ]) }, methods: { - menuSelect(key, keyPath) { - this.curTab = key + async getCheckUnitType(){ + const t = this + t.listLoading = true + let res = await getCheckUnitType() + if(res.data.code === "200"){ + t.unitType = res.data.result.checkUnitType + }else{ + t.$message({ + type:'warning', + message:res.data.message + }) + } + t.listLoading = false }, + + async getSpecialCheckTask(){ + const t = this + const res = await getSpecialCheckTask() + if(res.data.code === "200"){ + t.taskMenu = res.data.result.specialCheckTaskSimplifyInfos + t.$refs.wholesale.taskId = t.taskMenu[0].id + t.$refs.wholesale.enterpriseType = 1 + t.$refs.wholesale.getEnterpriseCompleteInfoList() + }else{ + t.$message({ + type:'warning', + message:res.data.message + }) + } + }, + + menuSelect(key, keyPath) { + const t = this + console.log(key, keyPath,'切换') + if(key == 1 || key == 2){ + t.$refs.wholesale.taskId = Number(keyPath[0]) + t.$refs.wholesale.enterpriseType = Number(key) + t.$refs.wholesale.getEnterpriseCompleteInfoList() + }else{ + t.$refs.sumSheet.taskId = Number(keyPath[0]) + t.$refs.sumSheet.getDataStatistics() + } + t.curTab = key + }, + sendJob(){ this.$refs.send.dialogVisible = true } @@ -88,22 +136,30 @@ align-items: flex-start; .menu-area{ - width: 20%; + width: 18%; .add-btn{ width: 100%; margin-bottom: 20px; background: #034EA2; } - .menu-tit{ + ::v-deep.el-submenu__title{ + height: auto; + line-height: 1.5; + padding: 20px 24px 20px 0; + white-space: pre-wrap; + } + ::v-deep.el-menu-item{ width: 100%; - background: #eee; - padding: 20px 20px 10px; - font-size: 18px; - font-weight: bolder; + box-sizing: border-box; + height: auto; + line-height: 1.5; + padding: 20px 24px 20px 0; + min-width: 100px; + white-space: pre-wrap; } } .table-area{ - width: calc(80% - 20px); + width: calc(82% - 20px); } } </style> -- Gitblit v1.9.2