Ver código fonte

列表增加派单功能,BUG修复

seimin 3 anos atrás
pai
commit
db0ec60790

+ 298 - 0
src/components/showModel/showModel.vue

@@ -0,0 +1,298 @@
1
+<template>
2
+  <div class="showModel" v-if="disjunctor">
3
+    <div class="showModel__wrap">
4
+      <div class="showModel__header" v-if="title">
5
+        {{ title }}
6
+        <span v-if="operate.know == '知道了' && timerFlag">({{ time }})</span>
7
+      </div>
8
+      <div class="showModel__article">
9
+        <span
10
+          v-if="icon"
11
+          class="showModel__icon icon_transport"
12
+          :class="[
13
+            'showModel__icon--' + icon,
14
+            { 'transport-duigou': icon === 'success' },
15
+            { 'transport-shibai': icon === 'error' },
16
+            { 'transport-wenhao': icon === 'warn' }
17
+          ]"
18
+        ></span>
19
+        <div v-if="content" class="showModel__content" v-html="content"></div>
20
+        <div v-if="info" class="showModel__info">{{ info }}</div>
21
+        <div class="select-wrap" v-if="selectName === 'user'">
22
+          <cube-select
23
+            v-model="selectUserId"
24
+            :options="selectData"
25
+            placeholder="请选择指派对象"
26
+          ></cube-select>
27
+        </div>
28
+      </div>
29
+      <div class="showModel__footer">
30
+        <div v-if="operate.ok" class="showModel__ok" @click="ok">
31
+          {{ operate.ok || "" }}
32
+        </div>
33
+        <div v-if="operate.cancel" class="showModel__cancel" @click="cancel">
34
+          {{ operate.cancel || "" }}
35
+        </div>
36
+        <div v-if="operate.know" class="showModel__know" @click="know">
37
+          {{ operate.know || "" }}
38
+        </div>
39
+        <div
40
+          v-if="operate.know && timerFlag"
41
+          class="showModel__know"
42
+          @click="cancelTimer"
43
+        >
44
+          取消自动关闭
45
+        </div>
46
+      </div>
47
+    </div>
48
+  </div>
49
+</template>
50
+
51
+<script>
52
+export default {
53
+  data() {
54
+    return {
55
+      time: 5, //5秒后自动关闭
56
+      timer: null, //5秒后自动关闭,定时器
57
+      timerFlag: true, //是否显示取消自动关闭按钮
58
+      selectData: [], //select数据
59
+      selectUserId: 0 //select选中的数据
60
+    };
61
+  },
62
+  watch: {
63
+    disjunctor(newValue) {
64
+      if (newValue && this.selectName === "user") {
65
+        this.selectUserId = 0;
66
+      }
67
+      if (newValue && this.operate.know == "知道了") {
68
+        this.time = 5;
69
+        this.timer = setInterval(() => {
70
+          this.time--;
71
+          if (this.time <= 0) {
72
+            clearInterval(this.timer);
73
+            this.know();
74
+          }
75
+        }, 1000);
76
+      }
77
+    }
78
+  },
79
+  props: {
80
+    // 显示隐藏
81
+    disjunctor: {
82
+      type: Boolean,
83
+      default: false
84
+    },
85
+    // 标题
86
+    title: {
87
+      type: String,
88
+      default: "提示"
89
+    },
90
+    // 图标
91
+    icon: {
92
+      type: String,
93
+      default: "success"
94
+    },
95
+    // 内容
96
+    content: {
97
+      type: String,
98
+      default: ""
99
+    },
100
+    // 说明
101
+    info: {
102
+      type: String,
103
+      default: ""
104
+    },
105
+    // 下拉框(user)
106
+    selectName: {
107
+      type: String,
108
+      default: ""
109
+    },
110
+    // 操作按钮文字
111
+    operate: {
112
+      type: Object,
113
+      default: () => {
114
+        return {
115
+          know: "知道了"
116
+        };
117
+      }
118
+    }
119
+  },
120
+  methods: {
121
+    // 获取指派对象
122
+    getZpUser() {
123
+      var postData = {
124
+        idx: 0,
125
+        sum: 1000,
126
+        user: {
127
+          roledata: { rolecode: "first-line support" },
128
+          roledata2: { rolecode: "second-line support" },
129
+          selectType: "1"
130
+        }
131
+      };
132
+      this.$http
133
+        .post("service/user/data/fetchDataList/user", postData)
134
+        .then(res => {
135
+          res.data.list.forEach((v, i) => {
136
+            this.selectData.push({
137
+              text: v.name,
138
+              value: v.id
139
+            });
140
+          });
141
+        });
142
+    },
143
+    // 单选框选中
144
+    radioChange(item) {
145
+      this.$emit("radioChange", item.target.value);
146
+    },
147
+    // 确定
148
+    ok() {
149
+      if (this.selectName) {
150
+        this.$emit("ok", this.selectUserId);
151
+      } else {
152
+        this.$emit("ok");
153
+      }
154
+    },
155
+    // 取消
156
+    cancel() {
157
+      this.$emit("cancel");
158
+    },
159
+    // 知道了
160
+    know() {
161
+      clearInterval(this.timer);
162
+      this.$emit("know");
163
+    },
164
+    // 取消自动关闭
165
+    cancelTimer() {
166
+      this.timerFlag = false;
167
+      clearInterval(this.timer);
168
+    }
169
+  },
170
+  created() {
171
+    if (this.selectName === "user") {
172
+      this.getZpUser();
173
+    }
174
+  }
175
+};
176
+</script>
177
+
178
+<style lang="less">
179
+.showModel {
180
+  position: fixed;
181
+  left: 0;
182
+  right: 0;
183
+  top: 0;
184
+  bottom: 0;
185
+  background-color: rgba(0, 0, 0, 0.2);
186
+  z-index: 99;
187
+
188
+  .showModel__wrap {
189
+    width: 5.6rem;
190
+    position: absolute;
191
+    left: 50%;
192
+    top: 50%;
193
+    transform: translate(-50%, -50%);
194
+    background-color: #fff;
195
+    border-radius: 0.12rem;
196
+
197
+    .showModel__header {
198
+      font-size: 0.36rem;
199
+      color: 000;
200
+      height: 0.84rem;
201
+      display: flex;
202
+      justify-content: center;
203
+      align-items: center;
204
+    }
205
+
206
+    .showModel__article {
207
+      margin: 0.4rem auto 0.25rem;
208
+      width: 4.88rem;
209
+      padding: 0.6rem 0;
210
+      background-color: rgb(249, 250, 251);
211
+      border: 0.02rem solid rgb(229, 233, 237);
212
+      border-radius: 0.12rem;
213
+      box-sizing: border-box;
214
+      display: flex;
215
+      flex-direction: column;
216
+      justify-content: center;
217
+      align-items: center;
218
+
219
+      .showModel__icon {
220
+        font-size: 1.38rem;
221
+        margin-bottom: 0.32rem;
222
+
223
+        &.showModel__icon--success {
224
+          color: rgb(52, 179, 73);
225
+        }
226
+
227
+        &.showModel__icon--warn {
228
+          color: rgb(245, 165, 35);
229
+        }
230
+
231
+        &.showModel__icon--error {
232
+          color: rgb(255, 58, 82);
233
+        }
234
+      }
235
+
236
+      .showModel__content {
237
+        font-size: 0.36rem;
238
+      }
239
+
240
+      .showModel__info {
241
+        font-size: 0.32rem;
242
+        color: rgb(102, 102, 102);
243
+      }
244
+      .select-wrap {
245
+        width: 80%;
246
+        margin: 0 auto;
247
+      }
248
+      .specialCloseFlag {
249
+        width: 90%;
250
+        height: 100%;
251
+        padding: 0.16rem;
252
+      }
253
+    }
254
+
255
+    .showModel__footer {
256
+      box-sizing: border-box;
257
+      height: 1rem;
258
+      border-top: 0.02rem solid rgb(229, 233, 237);
259
+      display: flex;
260
+      align-items: center;
261
+
262
+      div {
263
+        height: 100%;
264
+        display: flex;
265
+        align-items: center;
266
+        justify-content: center;
267
+        font-size: 0.36rem;
268
+        color: rgb(102, 102, 102);
269
+        position: relative;
270
+
271
+        &:nth-of-type(2)::before {
272
+          content: "";
273
+          position: absolute;
274
+          left: 0;
275
+          bottom: 0;
276
+          width: 0.02rem;
277
+          height: 0.87rem;
278
+          background-color: rgb(229, 233, 237);
279
+        }
280
+      }
281
+
282
+      .showModel__ok {
283
+        flex: 1;
284
+        color: #005395;
285
+      }
286
+
287
+      .showModel__cancel {
288
+        flex: 1;
289
+      }
290
+
291
+      .showModel__know {
292
+        flex: 1;
293
+        color: #005395;
294
+      }
295
+    }
296
+  }
297
+}
298
+</style>

+ 122 - 23
src/views/incidentList.vue

@@ -17,7 +17,7 @@
17 17
             @pulling-down="onPullingDown"
18 18
             @pulling-up="onPullingUp"
19 19
           >
20
-            <div class="conentBox">
20
+            <div class="conentBox" v-if="!loadShow && items.length">
21 21
               <div
22 22
                 class="conent"
23 23
                 v-for="item in items"
@@ -84,18 +84,21 @@
84 84
                   >
85 85
                   <span>{{ item.acceptDate | timeFormat("MM-dd HH:mm") }}</span>
86 86
                 </div>
87
-                <cube-form-group class="sub">
88
-                  <cube-button @click="assign(item)">指派</cube-button>
87
+                <cube-form-group
88
+                  class="sub-btn"
89
+                  v-show="
90
+                    (item.state.id === 1544 || item.state.id === 1543) &&
91
+                      isAssign &&
92
+                      item.assignee
93
+                  "
94
+                >
95
+                  <cube-button @click.stop="assign(item)">指派</cube-button>
89 96
                 </cube-form-group>
90 97
               </div>
91
-              <div class="wushuju" v-show="wushuju">
92
-                <img src="./../../static/images/wushuju.svg" alt />
93
-                <p>暂无事件</p>
94
-              </div>
95 98
             </div>
96
-            <template v-if="customPullDown" slot="pulldown" slot-scope="props">
99
+            <template slot="pulldown" slot-scope="props">
97 100
               <div
98
-                v-if="props.pullDownRefresh"
101
+                v-if="props.pullDownRefreshObj"
99 102
                 class="cube-pulldown-wrapper"
100 103
                 :style="props.pullDownStyle"
101 104
               >
@@ -121,15 +124,30 @@
121 124
                 </div>
122 125
               </div>
123 126
             </template>
127
+            <div class="wushuju" v-if="!loadShow && items.length === 0">
128
+              <img src="./../../static/images/wushuju.svg" alt />
129
+              <p>暂无事件</p>
130
+            </div>
124 131
           </cube-scroll>
125 132
         </div>
126 133
       </div>
127 134
     </div>
128
-    <load-ing v-show="!items.length && !wushuju"></load-ing>
135
+    <load-ing v-show="loadShow"></load-ing>
136
+    <!-- 弹窗 -->
137
+    <showModel
138
+      :title="models.title"
139
+      :icon="models.icon"
140
+      :disjunctor="models.disjunctor"
141
+      @ok="ok"
142
+      @cancel="cancel"
143
+      :operate="models.operate"
144
+      selectName="user"
145
+    ></showModel>
129 146
   </div>
130 147
 </template>
131 148
 <script>
132 149
 import Vue from "vue";
150
+import showModel from "../components/showModel/showModel.vue";
133 151
 import CubePage from "../components/cube-page.vue";
134 152
 import SwitchOption from "../components/switch-option";
135 153
 import InputOption from "../components/input-option";
@@ -139,20 +157,24 @@ import LoadIng from "./../views/loading.vue";
139 157
 export default {
140 158
   data() {
141 159
     return {
142
-      //   items: _foods,
160
+      modelsData: null, //点击弹窗的那一项数据
161
+      // 弹窗model
162
+      models: {
163
+        disjunctor: false
164
+      },
165
+      isAssign: false, //是否是事件经理或事件分类管理员
143 166
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
144 167
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
145 168
       items: [],
146 169
       pullDownRefresh: true,
147 170
       pullDownRefreshThreshold: 60,
148 171
       pullDownRefreshStop: 40,
149
-      pullDownRefreshTxt: "Refresh success",
172
+      pullDownRefreshTxt: "更新成功",
150 173
       pullUpLoad: true,
151 174
       pullUpLoadThreshold: 0,
152 175
       pullUpLoadMoreTxt: "加载更多",
153 176
       pullUpLoadNoMoreTxt: "没有更多数据",
154 177
       customPullDown: true,
155
-      wushuju: false,
156 178
       candidateGroups: "",
157 179
       searchsType: [
158 180
         {
@@ -185,7 +207,8 @@ export default {
185 207
     SwitchOption,
186 208
     InputOption,
187 209
     SelectOption,
188
-    LoadIng
210
+    LoadIng,
211
+    showModel
189 212
   },
190 213
   computed: {
191 214
     options() {
@@ -216,6 +239,73 @@ export default {
216 239
     }
217 240
   },
218 241
   methods: {
242
+    //确定
243
+    ok(selectUserId) {
244
+      console.log(selectUserId);
245
+      if (!selectUserId) {
246
+        this.$createDialog({
247
+          type: "alert",
248
+          title: "请选择指派对象",
249
+          icon: "cubeic-warn"
250
+        }).show();
251
+        return;
252
+      }
253
+      const toast = this.$createToast({
254
+        txt: "Loading...",
255
+        mask: true
256
+      });
257
+      toast.show();
258
+      this.$http
259
+        .post("service/bpm/bpm/delegateTask/" + this.modelsData.taskId, {
260
+          assginee: selectUserId
261
+        })
262
+        .then(res => {
263
+          toast.hide();
264
+          this.models.disjunctor = false;
265
+          if (res.status == 200) {
266
+            this.$createDialog({
267
+              type: "alert",
268
+              title: "操作成功",
269
+              icon: "cubeic-right",
270
+              onConfirm: (e, promptValue) => {
271
+                this.loadShow = true;
272
+                this.items = [];
273
+                this.idx = 0;
274
+                this.getData();
275
+              }
276
+            }).show();
277
+          } else {
278
+            this.$createDialog({
279
+              type: "alert",
280
+              title: "系统错误,请稍后再试!",
281
+              icon: "cubeic-wrong",
282
+              onConfirm: (e, promptValue) => {
283
+                this.loadShow = true;
284
+                this.items = [];
285
+                this.idx = 0;
286
+                this.getData();
287
+              }
288
+            }).show();
289
+          }
290
+        });
291
+    },
292
+    //取消
293
+    cancel() {
294
+      this.models.disjunctor = false;
295
+    },
296
+    // 指派
297
+    assign(item) {
298
+      this.modelsData = item;
299
+      this.models = {
300
+        disjunctor: true,
301
+        title: "指派对象",
302
+        icon: "warn",
303
+        operate: {
304
+          ok: "确定",
305
+          cancel: "取消"
306
+        }
307
+      };
308
+    },
219 309
     getParamsState() {
220 310
       if (this.$route.params.type) {
221 311
         this.type = this.$route.params.type;
@@ -284,16 +374,19 @@ export default {
284 374
         .post("service/bpm/bpm/fetchTask/bpm_incident", postData)
285 375
         .then(function(res) {
286 376
           if (res.data.data.length > 0) {
287
-            that.wushuju = false;
288 377
             for (var i = 0; i < res.data.data.length; i++) {
289 378
               res.data.data[i].createTime = formatDate(
290 379
                 new Date(res.data.data[i].createTime),
291 380
                 "yyyy-MM-dd hh:mm"
292 381
               );
293 382
             }
294
-            that.items = that.items.concat(res.data.data);
295
-          } else if (res.data.data.length <= 0) {
296
-            that.wushuju = true;
383
+            if (that.idx) {
384
+              that.items = that.items.concat(res.data.data);
385
+            } else {
386
+              that.items = res.data.data;
387
+            }
388
+          } else {
389
+            that.pullUpLoad = false;
297 390
           }
298 391
           that.loadShow = false;
299 392
         });
@@ -302,7 +395,6 @@ export default {
302 395
       var that = this;
303 396
       that.idx = 0;
304 397
       that.sum = 10;
305
-      that.items = [];
306 398
       setTimeout(() => {
307 399
         that.getData();
308 400
       }, 1000);
@@ -345,6 +437,13 @@ export default {
345 437
   },
346 438
   created() {
347 439
     var that = this;
440
+    if (this.loginUser.role.length) {
441
+      this.isAssign = this.loginUser.role.some(
442
+        v =>
443
+          v.rolecode === "incident-category-manager" ||
444
+          v.rolecode === "incident manager"
445
+      );
446
+    }
348 447
     that.loginUser.group.forEach(element => {
349 448
       that.candidateGroups += element.id + ",";
350 449
     });
@@ -353,6 +452,7 @@ export default {
353 452
       that.candidateGroups.length - 1
354 453
     );
355 454
     this.getParamsState();
455
+    this.loadShow = true;
356 456
     this.getData();
357 457
 
358 458
     localStorage.removeItem("modelData");
@@ -366,16 +466,15 @@ export default {
366 466
 };
367 467
 </script>
368 468
 <style lang="stylus" rel="stylesheet/stylus" scoped>
369
-.sub {
469
+.sub-btn {
370 470
   background: #ececec;
371 471
   .cube-btn {
372 472
     background-color: #005395 !important;
473
+    border-radius: 8px
373 474
   }
374 475
 }
375 476
 .scroll-list-wrap {
376
-  /* height: 350px */
377
-  height: 85vh;
378
-  /* border: 1px solid rgba(0, 0, 0, 0.1) */
477
+  height: calc(100vh - 2.72rem);
379 478
   border-radius: 5px;
380 479
   transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
381 480
   overflow: hidden;

+ 2 - 2
src/views/indes.vue

@@ -191,10 +191,10 @@
191 191
           </span>
192 192
         </div>
193 193
         <div class="conentBox" v-if="!newNoticeNoData && !newNoticeLoading">
194
-          <div class="conent" v-for="v in noticeData" @click="toGuideDetail(v)">
194
+          <div class="conent" v-for="v in noticeData" :key="v.id" @click="toGuideDetail(v)">
195 195
             <div class="head overflowEllipsis2">{{ v.title }}</div>
196 196
             <div class="cot">
197
-              {{ v.createTime.substring(0, v.createTime.length - 5) }}
197
+              {{ v.createTime | timeFormat("yyyy-MM-dd HH:mm") }}
198 198
             </div>
199 199
           </div>
200 200
         </div>

+ 6 - 6
src/views/processing.vue

@@ -322,10 +322,10 @@
322 322
                     :field="fields[6]"
323 323
                     v-if="order == 2"
324 324
                   ></cube-form-item>
325
-                  <cube-form-item
325
+                  <!-- <cube-form-item
326 326
                     :field="fields[15]"
327 327
                     v-if="order == 5"
328
-                  ></cube-form-item>
328
+                  ></cube-form-item> -->
329 329
                   <cube-form-item
330 330
                     :field="fields[7]"
331 331
                     v-if="order == 2"
@@ -544,10 +544,10 @@ export default {
544 544
           label: "转派",
545 545
           value: 3
546 546
         },
547
-        {
548
-          label: "指派",
549
-          value: 5
550
-        }
547
+        // {
548
+        //   label: "指派",
549
+        //   value: 5
550
+        // }
551 551
         // {
552 552
         //   label: "协同",
553 553
         //   value: 4