研发图纸文件管理系统-前端项目
longyvfengyun
2024-01-02 bb89a0a6111a9c98d54411d41ec2e63575eea53f
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<template>
    <div class="work-place-wrapper">
        <div class="work-place-container">
            <div class="work-place">
                <a-row :gutter="18" class="work-place-top">
                    <a-col :span="item.span" v-for="(item, key) in totals" :key="'key' + key">
                        <total-card
                            :info="item"
                            :type="item.type"
                            :title="item.title"
                            :num="item.value"
                            @click="changeTotalCard"
                        ></total-card>
                    </a-col>
                </a-row>
                <div style="margin-top: 8px">
                    <my-draw :is-show="'my' == cardName" :y="y" @resize="resize"></my-draw>
                    <not-approved
                        :is-show="'approving' == cardName"
                        :y="y"
                        @resize="resize"
                    ></not-approved>
                    <rejected-list
                        :is-show="'rejected' == cardName"
                        :y="y"
                        @resize="resize"
                    ></rejected-list>
                    <approved-list
                        :is-show="'approved' == cardName"
                        :y="y"
                        @resize="resize"
                    ></approved-list>
                    <handling-list
                        :is-show="'handling' == cardName"
                        :y="y"
                        @resize="resize"
                    ></handling-list>
                    <handled-list
                        :is-show="'handled' == cardName"
                        :y="y"
                        @resize="resize"
                    ></handled-list>
                    <feedback-list
                        :is-show="'sendFk' == cardName ||'recevierFk' == cardName"
                        :type="cardName"
                        :y="y"
                        @resize="resize"
                    ></feedback-list>
                    <!-- v-if="'sendFk' == cardName"
                    v-if="'recevierFk' == cardName" -->
                    <!-- <feedback-list
                        :is-show="'recevierFk' == cardName"
                        :type="cardName"
                        :y="y"
                        @resize="resize"
                    ></feedback-list> -->
                </div>
            </div>
        </div>
        <div class="log-wrapper">
            <today-log></today-log>
        </div>
    </div>
</template>
 
<script>
import MyDraw from "./myDraw";
import TotalCard from "./totalCard";
import NotApproved from "@/pages/workplace/notApproved/NotApproved";
import RejectedList from "@/pages/workplace/rejectedList/RejectedList";
import ApprovedList from "@/pages/workplace/approvedList/ApprovedList";
import const_total from "./const_total";
import { mapGetters, mapState } from "vuex";
import getItemByKey from "@/assets/js/tools/getItemByKey";
import { statusStatistic } from "@/pages/workplace/apis";
import HandlingList from "@/pages/workplace/handlingList/HandlingList";
import HandledList from "@/pages/workplace/handledList/HandledList";
import FeedbackList from "@/pages/workplace/feedbackList/feedbackList";
import createWs from "@/assets/js/websocket";
import TodayLog from "@/pages/components/TodayLog.vue";
const WSMixin = createWs("worksheet");
 
export default {
  name: "WorkPlace",
  components: {
      TodayLog,
    HandledList,
    HandlingList,
    ApprovedList,
    RejectedList,
    NotApproved,
    MyDraw,
    TotalCard,
    FeedbackList,
  },
  mixins: [WSMixin],
  data() {
    return {
      loading: false,
      update: -1,
      y: 400,
      drawUploadVisible: false,
      cardName: "my",
      totals: const_total.normal,
      radio: 0,
    };
  },
  watch: {
    update(n) {
      if (-1 != n && !this._inactive) {
        const bar = document.querySelectorAll(".header-bar")[0].clientHeight;
        const workPlaceTop =
          document.querySelectorAll(".work-place-top")[0].clientHeight;
        this.y = this.minHeight - bar - workPlaceTop - 56;
      }
    },
    affixed() {
      this.resize();
    },
    cardName() {
      this.resize();
    },
    minHeight() {
      this.resize();
    },
  },
  methods: {
    resize() {
      setTimeout(() => {
        this.update = Math.random();
      }, 200);
    },
    onWSMessage(res) {
      let rs = JSON.parse(res.data);
      let data = rs.data;
      this.totals.map((item) => {
        let name = item.name;
        item.value = data[name] ? data[name] : 0;
      });
    },
    changeTotalCard(info) {
      // console.log(info.name, "nam");
      this.cardName = "";
      this.$nextTick(() => {
        this.cardName = info.name;
      });
    },
    /**
     * 根据用户角色,变更统计的面板的样式
     * @param type 用户类型:1-普通用户;2-项目经理;3-总经理;4-管理员
     */
    changeTotal(type) {
      switch (type) {
        case 2:
          this.totals = const_total.projectManage;
          break;
        case 3:
          this.totals = const_total.generalManage;
          break;
        default:
          this.totals = const_total.normal;
          break;
      }
      this.cardName = this.totals[0].name;
      // 查询角色对应的数据值
      this.statusStatistic();
    },
    radioChange() {
      this.changeTotal(this.radio);
    },
    statusStatistic() {
      statusStatistic()
        .then((res) => {
          let rs = res.data;
          if (rs.code == 1) {
            let data = rs.data;
            this.totals.map((item) => {
              let name = item.name;
              item.value = data[name] ? data[name] : 0;
            });
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    activeFN() {
      this.resize();
    },
  },
  computed: {
    ...mapGetters("account", ["roles", "roleList", "departmentList"]),
    ...mapGetters("setting", ["affixed", "minHeight"]),
  },
  mounted() {
    let role = getItemByKey(this.roles[0].id, this.roleList);
    this.changeTotal(role.value);
  },
};
</script>
 
<style scoped>
.work-place-wrapper {
    display: flex;
    height: 100%;
}
.work-place-container {
    flex:1;
    position: relative;
    height: 100%;
}
.work-place {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.log-wrapper {
    width: 450px;
    height: 100%;
    overflow-y: auto;
    padding-left: 4px;
    padding-bottom: 4px;
    position: relative;
}
</style>