郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<template>
    <div class="app-container" style="padding-bottom:40px">
        <div class="menu-area">
            <el-button v-if="unitType==1" class="add-btn" type="primary" icon="el-icon-plus" @click="sendJob()">新任务下发</el-button>
            <el-menu
                v-if="taskMenu && taskMenu.length>0"
                default-active="0-1"
                class="el-menu-vertical-demo"
                background-color="#eee"
                text-color="#333"
                unique-opened
                active-text-color="#034EA2"
                @select="menuSelect">
                <el-submenu v-for="(item,i) in taskMenu" :key="i" :index="item.id + '-' + item.taskName">
                    <template slot="title">
                        <i class="el-icon-s-order"></i>
                        <span>{{item.taskName}}</span>
                    </template>
                    <el-menu-item :index="i + '-' + 1">安全检查反馈情况(批发)</el-menu-item>
                    <el-menu-item :index="i + '-' + 2">安全检查反馈情况(零售)</el-menu-item>
                    <el-menu-item :index="i + '-' + 3" v-if="unitType==0||unitType==1||unitType==2">安全检查情况汇总</el-menu-item>
                </el-submenu>
            </el-menu>
            <div v-else style="background:#eee;color: #333;font-size: 16px;padding: 20px 10px">
                暂无任务
            </div>
        </div>
        <div class="table-area" v-if="taskMenu && taskMenu.length>0">
            <wholesale-form v-show="curTab == 1 || curTab == 2" ref="wholesale"></wholesale-form>
            <sum-sheet v-show="curTab == 3" ref="sumSheet"></sum-sheet>
        </div>
        <div v-else class="table-area" style="text-align:center;">暂无任务信息</div>
        <send-work ref="send"></send-work>
    </div>
</template>
 
<script>
    import Cookies from 'js-cookie'
    import {computePageCount} from "../../utils";
    import {mapGetters} from "vuex";
    import {MessageBox} from 'element-ui'
    import { getToken } from '@/utils/auth'
    import wholesaleForm from './components/wholesaleForm'
    import sumSheet from "./components/sumSheet"
    import sendWork from "./components/sendWork"
    import { getCheckUnitType, getSpecialCheckTask } from "@/api/specialCheck"
 
    export default {
        name: "specialCheck",
        components:{
            wholesaleForm,
            sumSheet,
            sendWork
        },
        data() {
            return {
                curTab: 1,
                unitType: null,
                taskMenu: [],
                taskId: null,
                openeds:[]
            }
        },
        created() {
            const t = this
            t.getCheckUnitType()
            t.getSpecialCheckTask()
        },
        mounted() {
 
        },
        computed: {
            ...mapGetters([
                'userType',
                'name'
            ])
        },
        methods: {
            async getCheckUnitType(){
                const t = this
                let res = await getCheckUnitType()
                if(res.data.code === "200"){
                    t.unitType = res.data.result.checkUnitType
                }else{
                    t.$message({
                        type:'warning',
                        message:res.data.message
                    })
                }
            },
 
            async getSpecialCheckTask(){
                const t = this
                const res = await getSpecialCheckTask()
                if(res.data.code === "200"){
                    t.taskMenu = res.data.result.specialCheckTaskSimplifyInfos
                    t.openeds[0] = t.taskMenu[0].id + '-' + t.taskMenu[0].taskName
                    t.openeds[1] = '1'
                }else{
                    t.$message({
                        type:'warning',
                        message:res.data.message
                    })
                }
            },
 
            menuSelect(key, keyPath) {
                const t = this
                t.$refs.wholesale.currentPage = 1
                t.$refs.wholesale.pageSize = 10
                if(key.split('-')[1] == '1' || key.split('-')[1] == '2'){
                    t.$refs.wholesale.taskId = Number(keyPath[0].split('-')[0])
                    t.$refs.wholesale.taskName = keyPath[0].split('-')[1]
                    t.$refs.wholesale.enterpriseType = Number(key.split('-')[1])
                    t.$refs.wholesale.getEnterpriseCompleteInfoList()
                }else{
                    t.$refs.sumSheet.taskId = Number(keyPath[0].split('-')[0])
                    t.$refs.sumSheet.taskName = keyPath[0].split('-')[1]
                    t.$refs.sumSheet.enterpriseCity = ''
                    t.$refs.sumSheet.enterpriseArea = ''
                    if(t.unitType == 0){
                        t.$refs.sumSheet.sheetStatus=1
                    }else{
                        t.$refs.sumSheet.sheetStatus = t.unitType
                    }
                    t.$refs.sumSheet.activeTab = 1
                    t.$refs.sumSheet.getDataStatistics()
                }
                t.curTab = Number(key.split('-')[1])
            },
 
            sendJob(){
                this.$refs.send.dialogVisible = true
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .app-container{
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
 
        .menu-area{
            width: 18%;
 
            .el-menu{
                height: 80vh;
                overflow: hidden;
                overflow-y: scroll;
                &::-webkit-scrollbar { width: 0; height: 0; color: transparent }
                &::scrollbar { width: 0; height: 0; color: transparent }
            }
            .add-btn{
                width: 100%;
                margin-bottom: 20px;
                background: #034EA2;
            }
            ::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%;
                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(82% - 20px);
        }
    }
</style>