seimin 2 gadi atpakaļ
vecāks
revīzija
06c0cceaab
3 mainītis faili ar 370 papildinājumiem un 27 dzēšanām
  1. 236 0
      src/custom/seiminModel.vue
  2. 3 0
      src/views/Login.vue
  3. 131 27
      src/views/newIncident.vue

+ 236 - 0
src/custom/seiminModel.vue

@@ -0,0 +1,236 @@
1
+<template>
2
+  <div class="seiminModel" v-if="opts.isVisible">
3
+    <div class="seiminModel_container">
4
+      <!-- 标题 -->
5
+      <div class="seiminModel_header" :class="{ noTitle: !opts.title }">
6
+        <span>{{ opts.title }}</span>
7
+      </div>
8
+      <div class="seiminModel_content">
9
+        <!-- 内容 -->
10
+        <div class="seiminModel_txt" v-html="opts.content"></div>
11
+        <div class="seiminModel_item">
12
+          <label>工时<span class="red">*</span>:</label>
13
+          <cube-select
14
+            v-model="complexity"
15
+            :options="complexityList"
16
+            @change="changeHandler()"
17
+          >
18
+          </cube-select>
19
+        </div>
20
+        <div
21
+          class="seiminModel_item"
22
+          v-if="(type === 'handler' && complexity != complexitySource) || type == 'now'"
23
+        >
24
+          <label>升级原因<span class="red">*</span>:</label>
25
+          <cube-textarea
26
+            v-model="updateReason"
27
+            placeholder="请填写升级原因"
28
+          ></cube-textarea>
29
+        </div>
30
+      </div>
31
+      <!-- 底部 -->
32
+      <div class="seiminModel_footer">
33
+        <div
34
+          class="seiminModel_footer__btn"
35
+          v-for="(btn, i) in opts.btns"
36
+          :style="{
37
+            flex: btn.flex,
38
+            color: btn.textColor
39
+          }"
40
+          @click="btn.click($event)"
41
+          :key="i"
42
+        >
43
+          {{ btn.name }}
44
+        </div>
45
+      </div>
46
+    </div>
47
+  </div>
48
+</template>
49
+<script>
50
+export default {
51
+  name: "seiminModel",
52
+  data() {
53
+    return {
54
+      type: "",
55
+      category: null,
56
+      complexitySource: "",
57
+      complexity: "",
58
+      updateReason: "",
59
+      complexityList: [],
60
+      opts: {}
61
+    };
62
+  },
63
+  methods: {
64
+    // 修改工时
65
+    changeHandler() {
66
+      if (this.type === "handler" && this.complexitySource == this.complexity) {
67
+        this.updateReason = "";
68
+      }
69
+    },
70
+    // 查询祖辈积分
71
+    complexityFn(category) {
72
+      console.log(category);
73
+      if (category.complexity) {
74
+        return category.complexity.value;
75
+      } else if (category.parent) {
76
+        return this.complexityFn(category.parent);
77
+      } else {
78
+        return this.complexityList[0] ? this.complexityList[0].value : 1;
79
+      }
80
+    },
81
+    // 获取积分字典
82
+    getComplexity(args) {
83
+      this.$http
84
+        .post("service/common/common/getDictionary", {
85
+          key: "incident_complexity",
86
+          type: "list"
87
+        })
88
+        .then(res => {
89
+          this.complexitySource = this.complexityFn(this.category);
90
+          this.complexity = this.complexityFn(this.category);
91
+          args.content = `您本次事件处理获得工时${this.complexitySource},如遇问题对工时进行调整`;
92
+          res.data.forEach((v, i) => {
93
+            this.complexityList.push({
94
+              text: v.name,
95
+              value: v.value
96
+            });
97
+            // 默认配置项
98
+            let defaultOptions = {
99
+              skin: "default", //弹窗风格(default|toast|qrcode|)
100
+              isVisible: false, //是否显示弹窗
101
+              title: "提示", //标题
102
+              icon: "success", //图标(success|error|warn|)
103
+              content: "", //内容
104
+              btns: [
105
+                {
106
+                  name: "取消",
107
+                  textColor: "#666",
108
+                  flex: 1,
109
+                  click: this.close
110
+                },
111
+                {
112
+                  name: "确认",
113
+                  textColor: "#49B856",
114
+                  flex: 1,
115
+                  click: this.close
116
+                }
117
+              ] //弹窗按钮
118
+            };
119
+            // 根据弹窗风格修改默认配置项
120
+            switch (args.skin) {
121
+              case "toast":
122
+                defaultOptions.btns = [
123
+                  {
124
+                    name: "知道了",
125
+                    textColor: "#49b856",
126
+                    flex: 1,
127
+                    click: this.close
128
+                  }
129
+                ];
130
+                break;
131
+            }
132
+            // 按钮合并参数
133
+            if (Array.isArray(args.btns)) {
134
+              let btns = [];
135
+              args.btns.forEach((v, i) => {
136
+                btns.push(Object.assign({}, defaultOptions.btns[i], v));
137
+              });
138
+              args.btns = btns;
139
+            }
140
+            // 合并配置
141
+            this.opts = Object.assign({}, defaultOptions, args, {
142
+              isVisible: true
143
+            });
144
+          });
145
+        });
146
+    },
147
+    // 显示弹窗
148
+    show(args = {}) {
149
+      this.category = args.category;
150
+      this.type = args.type;
151
+      this.getComplexity(args);
152
+    },
153
+    // 关闭弹窗
154
+    close() {
155
+      this.opts.isVisible = false;
156
+    }
157
+  }
158
+};
159
+</script>
160
+<style scoped lang="less">
161
+.seiminModel {
162
+  font-size: 0.36rem;
163
+  color: #000;
164
+  line-height: 0.5rem;
165
+  text-align: center;
166
+  background-color: rgba(0, 0, 0, 0.5);
167
+  position: fixed;
168
+  top: 0;
169
+  right: 0;
170
+  bottom: 0;
171
+  left: 0;
172
+  margin: auto;
173
+  z-index: 9;
174
+  display: flex;
175
+  justify-content: center;
176
+  align-items: center;
177
+  .seiminModel_container {
178
+    width: 5.6rem;
179
+    border-radius: 8px;
180
+    background-color: #fff;
181
+    display: flex;
182
+    flex-direction: column;
183
+    align-content: center;
184
+    .seiminModel_header {
185
+      height: 1rem;
186
+      position: relative;
187
+      display: flex;
188
+      justify-content: center;
189
+      align-items: center;
190
+    }
191
+    .seiminModel_content {
192
+      font-size: 0.24rem;
193
+      flex: 1;
194
+      background-color: #f9fafb;
195
+      margin: 0 0.36rem 0.25rem;
196
+      color: #333;
197
+      padding: 0.24rem;
198
+      border: 1px solid #e5e9ed;
199
+      word-break: break-all;
200
+      .seiminModel_item {
201
+        text-align: left;
202
+        margin-bottom: 0.16rem;
203
+        .red {
204
+          color: red;
205
+        }
206
+      }
207
+    }
208
+    .seiminModel_footer {
209
+      height: 1rem;
210
+      color: #666;
211
+      border-top: 1px solid #e5e9ed;
212
+      display: flex;
213
+      justify-content: center;
214
+      align-items: center;
215
+
216
+      .seiminModel_footer__btn {
217
+        height: 100%;
218
+        position: relative;
219
+        display: flex;
220
+        justify-content: center;
221
+        align-items: center;
222
+
223
+        &::after {
224
+          content: "";
225
+          height: 0.86rem;
226
+          position: absolute;
227
+          width: 1px;
228
+          bottom: 0;
229
+          right: 0;
230
+          background-color: #dde1e5;
231
+        }
232
+      }
233
+    }
234
+  }
235
+}
236
+</style>

+ 3 - 0
src/views/Login.vue

@@ -70,6 +70,9 @@ export default {
70 70
               case "ifRoom": //是否增加房间号选择
71 71
                 localStorage.setItem("ifRoom", v.valueconfig);
72 72
                 break;
73
+              case "integralMechanism": //积分机制
74
+                localStorage.setItem("integralMechanism", v.valueconfig);
75
+                break;
73 76
             }
74 77
           });
75 78
           this.$router.push({ path: "/main" });

+ 131 - 27
src/views/newIncident.vue

@@ -187,9 +187,11 @@
187 187
       :conents="promptingConent"
188 188
       :status="promptingStatus"
189 189
     ></promp-ting>
190
+    <seiminModel ref="seiminModel"></seiminModel>
190 191
   </div>
191 192
 </template>
192 193
 <script>
194
+import seiminModel from "./../custom/seiminModel";
193 195
 import CubePage from "./../components/cube-page.vue";
194 196
 import CubeButtonGroup from "./../components/cube-button-group.vue";
195 197
 import DatePicker from "./../components/date-picker.vue";
@@ -335,6 +337,7 @@ export default {
335 337
       wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"), //是否绑定资产
336 338
       ifRoom: localStorage.getItem("ifRoom"), //是否增加房间号选择
337 339
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
340
+      integralMechanism: localStorage.getItem("integralMechanism"),
338 341
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
339 342
       name: "",
340 343
       phone: "",
@@ -1180,9 +1183,89 @@ export default {
1180 1183
       if (this.$route.params.data && this.$route.params.data.id) {
1181 1184
         that.modelData.flow = this.$route.params.data.id;
1182 1185
       }
1186
+      if (
1187
+        this.order == 1 &&
1188
+        (this.integralMechanism == 1 ||
1189
+          (this.integralMechanism == 2 && this.loginUser.userType.value == 2))
1190
+      ) {
1191
+        // 直接处理,积分机制
1192
+        let category = this.initSjList.find(
1193
+          v => v.id == this.modelData.incident.category.id
1194
+        );
1195
+        this.$refs.seiminModel.show({
1196
+          category,
1197
+          type: "now",
1198
+          btns: [
1199
+            {
1200
+              click: () => {
1201
+                this.loadShow = false;
1202
+                this.$refs.seiminModel.close();
1203
+              }
1204
+            },
1205
+            {
1206
+              click: () => {
1207
+                if (!this.$refs.seiminModel.complexity) {
1208
+                  this.$createDialog({
1209
+                    type: "alert",
1210
+                    title: "操作失败",
1211
+                    content: "请选择工时!",
1212
+                    icon: "cubeic-wrong"
1213
+                  }).show();
1214
+                  return;
1215
+                }
1216
+                if (!this.$refs.seiminModel.updateReason.trim()) {
1217
+                  this.$createDialog({
1218
+                    type: "alert",
1219
+                    title: "操作失败",
1220
+                    content: "请填写升级原因!",
1221
+                    icon: "cubeic-wrong"
1222
+                  }).show();
1223
+                  return;
1224
+                }
1225
+                this.$refs.seiminModel.close();
1226
+                console.log("确定");
1227
+                this.handlerFn();
1228
+              }
1229
+            }
1230
+          ]
1231
+        });
1232
+      } else {
1233
+        this.handlerFn();
1234
+      }
1235
+      event.preventDefault();
1236
+    },
1237
+    commonFn() {
1238
+      let that = this;
1239
+      $("#fade").fadeIn();
1240
+      that.promptingConent = "恭喜您,新建报修成功!";
1241
+      that.promptingStatus = true;
1242
+      that.dialog = that
1243
+        .$createDialog({
1244
+          type: "alert",
1245
+          title: "新建成功",
1246
+          content: "点击返回首页",
1247
+          icon: "cubeic-right",
1248
+          onConfirm: (e, promptValue) => {
1249
+            that.$router.push({ path: "/main" });
1250
+          }
1251
+        })
1252
+        .show();
1253
+      localStorage.removeItem("category");
1254
+      localStorage.removeItem("model");
1255
+      localStorage.removeItem("modelData");
1256
+      localStorage.removeItem("placeIndex");
1257
+      localStorage.removeItem("referenceInfo");
1258
+      localStorage.removeItem("solution");
1259
+      localStorage.removeItem("order");
1260
+      setTimeout(function() {
1261
+        $("#fade").fadeOut();
1262
+      }, 2000);
1263
+    },
1264
+    handlerFn() {
1265
+      let that = this;
1183 1266
       that.$http
1184
-        .post("/service/bpm/bpm/start/bpm_incident", that.modelData)
1185
-        .then(function(res) {
1267
+        .post("service/bpm/bpm/start/bpm_incident", that.modelData)
1268
+        .then(res => {
1186 1269
           if (res.data) {
1187 1270
             that.action.target = that.action.target + res.data.id;
1188 1271
             that.action1.target = that.action1.target + res.data.id;
@@ -1192,30 +1275,51 @@ export default {
1192 1275
                 that.$refs.upload1.start();
1193 1276
               }
1194 1277
             }, 100);
1195
-            $("#fade").fadeIn();
1196
-            that.promptingConent = "恭喜您,新建报修成功!";
1197
-            that.promptingStatus = true;
1198
-            that.dialog = that
1199
-              .$createDialog({
1200
-                type: "alert",
1201
-                title: "新建成功",
1202
-                content: "点击返回首页",
1203
-                icon: "cubeic-right",
1204
-                onConfirm: (e, promptValue) => {
1205
-                  that.$router.push({ path: "/main" });
1206
-                }
1207
-              })
1208
-              .show();
1209
-            localStorage.removeItem("category");
1210
-            localStorage.removeItem("model");
1211
-            localStorage.removeItem("modelData");
1212
-            localStorage.removeItem("placeIndex");
1213
-            localStorage.removeItem("referenceInfo");
1214
-            localStorage.removeItem("solution");
1215
-            localStorage.removeItem("order");
1216
-            setTimeout(function() {
1217
-              $("#fade").fadeOut();
1218
-            }, 2000);
1278
+            if (
1279
+              this.order == 1 &&
1280
+              (this.integralMechanism == 1 ||
1281
+                (this.integralMechanism == 2 &&
1282
+                  this.loginUser.userType.value == 2))
1283
+            ) {
1284
+              //liaomingming
1285
+              this.$http
1286
+                .post("service/common/common/getDictionary", {
1287
+                  key: "incident_integral_state",
1288
+                  type: "list"
1289
+                })
1290
+                .then(result => {
1291
+                  result = result.data;
1292
+                  let auditState = result.find(v => v.value == 0);
1293
+                  let postData = {
1294
+                    incidentIntegral: {
1295
+                      incidentId: res.data.bussId,
1296
+                      auditState: auditState,
1297
+                      handlerUser: this.loginUser.id,
1298
+                      handlerUserName: this.loginUser.name,
1299
+                      sourceScore: this.$refs.seiminModel.complexitySource,
1300
+                      currentScore: this.$refs.seiminModel.complexity,
1301
+                      updateReason:
1302
+                        this.$refs.seiminModel.updateReason.trim() || undefined
1303
+                    }
1304
+                  };
1305
+                  this.$http
1306
+                    .post("service/bpm/data/addData/incidentIntegral", postData)
1307
+                    .then(result1 => {
1308
+                      if (result1.data.status == 200) {
1309
+                        this.commonFn();
1310
+                      } else {
1311
+                        this.$createDialog({
1312
+                          type: "alert",
1313
+                          title: "系统错误,请稍后再试!",
1314
+                          content: "",
1315
+                          icon: "cubeic-wrong"
1316
+                        }).show();
1317
+                      }
1318
+                    });
1319
+                });
1320
+            } else {
1321
+              this.commonFn();
1322
+            }
1219 1323
           } else {
1220 1324
             $("#fade").fadeIn();
1221 1325
             that.promptingConent = "系统错误,请稍后再试!";
@@ -1237,7 +1341,6 @@ export default {
1237 1341
             }, 2000);
1238 1342
           }
1239 1343
         });
1240
-      event.preventDefault();
1241 1344
     },
1242 1345
     validateHandler(result) {
1243 1346
       // this.submitHandler()
@@ -1685,6 +1788,7 @@ export default {
1685 1788
     }
1686 1789
   },
1687 1790
   components: {
1791
+    seiminModel,
1688 1792
     CubePage,
1689 1793
     CubeButtonGroup,
1690 1794
     DatePicker,