瀏覽代碼

积分机制

seimin 2 年之前
父節點
當前提交
2ec6e14b75
共有 4 個文件被更改,包括 692 次插入229 次删除
  1. 236 0
      src/custom/seiminModel.vue
  2. 3 0
      src/views/Login.vue
  3. 132 26
      src/views/newIncident.vue
  4. 321 203
      src/views/processing.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

@@ -180,6 +180,9 @@ export default {
180 180
               case "ifRoom": //是否增加房间号选择
181 181
                 localStorage.setItem("ifRoom", v.valueconfig);
182 182
                 break;
183
+              case "integralMechanism": //积分机制
184
+                localStorage.setItem("integralMechanism", v.valueconfig);
185
+                break;
183 186
             }
184 187
           });
185 188
           this.$router.push({ path: "/main" });

+ 132 - 26
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";
@@ -333,6 +335,7 @@ export default {
333 335
       wxIncidentWithCmdb: localStorage.getItem("wxIncidentWithCmdb"), //是否绑定资产
334 336
       ifRoom: localStorage.getItem("ifRoom"), //是否增加房间号选择
335 337
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
338
+      integralMechanism: localStorage.getItem("integralMechanism"),
336 339
       valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
337 340
       name: "",
338 341
       phone: "",
@@ -1167,9 +1170,91 @@ export default {
1167 1170
         that.selectHouseNumber,
1168 1171
         "2020年4月25日14:09:29"
1169 1172
       );
1173
+      // liaomingming
1174
+      console.log(that.modelData.incident.category.id, this.initSjList, "事件");
1175
+      if (
1176
+        this.order == 1 &&
1177
+        (this.integralMechanism == 1 ||
1178
+          (this.integralMechanism == 2 && this.loginUser.userType.value == 2))
1179
+      ) {
1180
+        // 直接处理,积分机制
1181
+        let category = this.initSjList.find(
1182
+          v => v.id == this.modelData.incident.category.id
1183
+        );
1184
+        this.$refs.seiminModel.show({
1185
+          category,
1186
+          type: "now",
1187
+          btns: [
1188
+            {
1189
+              click: () => {
1190
+                this.loadShow = false;
1191
+                this.$refs.seiminModel.close();
1192
+              }
1193
+            },
1194
+            {
1195
+              click: () => {
1196
+                if (!this.$refs.seiminModel.complexity) {
1197
+                  this.$createDialog({
1198
+                    type: "alert",
1199
+                    title: "操作失败",
1200
+                    content: "请选择工时!",
1201
+                    icon: "cubeic-wrong"
1202
+                  }).show();
1203
+                  return;
1204
+                }
1205
+                if (!this.$refs.seiminModel.updateReason.trim()) {
1206
+                  this.$createDialog({
1207
+                    type: "alert",
1208
+                    title: "操作失败",
1209
+                    content: "请填写升级原因!",
1210
+                    icon: "cubeic-wrong"
1211
+                  }).show();
1212
+                  return;
1213
+                }
1214
+                this.$refs.seiminModel.close();
1215
+                console.log("确定");
1216
+                this.handlerFn();
1217
+              }
1218
+            }
1219
+          ]
1220
+        });
1221
+      } else {
1222
+        this.handlerFn();
1223
+      }
1224
+      event.preventDefault();
1225
+    },
1226
+    commonFn() {
1227
+      let that = this;
1228
+      $("#fade").fadeIn();
1229
+      that.promptingConent = "恭喜您,新建报修成功!";
1230
+      that.promptingStatus = true;
1231
+      that.dialog = that
1232
+        .$createDialog({
1233
+          type: "alert",
1234
+          title: "新建成功",
1235
+          content: "点击返回首页",
1236
+          icon: "cubeic-right",
1237
+          onConfirm: (e, promptValue) => {
1238
+            that.$router.push({ path: "/main" });
1239
+          }
1240
+        })
1241
+        .show();
1242
+      localStorage.removeItem("category");
1243
+      localStorage.removeItem("model");
1244
+      localStorage.removeItem("modelData");
1245
+      localStorage.removeItem("placeIndex");
1246
+      localStorage.removeItem("referenceInfo");
1247
+      localStorage.removeItem("solution");
1248
+      localStorage.removeItem("order");
1249
+      setTimeout(function() {
1250
+        $("#fade").fadeOut();
1251
+      }, 2000);
1252
+    },
1253
+    handlerFn() {
1254
+      let that = this;
1170 1255
       that.$http
1171 1256
         .post("service/bpm/bpm/start/bpm_incident", that.modelData)
1172
-        .then(function(res) {
1257
+        .then(res => {
1173 1258
           if (res.data) {
1174 1259
             that.action.target = that.action.target + res.data.id;
1175 1260
             that.action1.target = that.action1.target + res.data.id;
@@ -1179,30 +1264,51 @@ export default {
1179 1264
                 that.$refs.upload1.start();
1180 1265
               }
1181 1266
             }, 100);
1182
-            $("#fade").fadeIn();
1183
-            that.promptingConent = "恭喜您,新建报修成功!";
1184
-            that.promptingStatus = true;
1185
-            that.dialog = that
1186
-              .$createDialog({
1187
-                type: "alert",
1188
-                title: "新建成功",
1189
-                content: "点击返回首页",
1190
-                icon: "cubeic-right",
1191
-                onConfirm: (e, promptValue) => {
1192
-                  that.$router.push({ path: "/main" });
1193
-                }
1194
-              })
1195
-              .show();
1196
-            localStorage.removeItem("category");
1197
-            localStorage.removeItem("model");
1198
-            localStorage.removeItem("modelData");
1199
-            localStorage.removeItem("placeIndex");
1200
-            localStorage.removeItem("referenceInfo");
1201
-            localStorage.removeItem("solution");
1202
-            localStorage.removeItem("order");
1203
-            setTimeout(function() {
1204
-              $("#fade").fadeOut();
1205
-            }, 2000);
1267
+            if (
1268
+              this.order == 1 &&
1269
+              (this.integralMechanism == 1 ||
1270
+                (this.integralMechanism == 2 &&
1271
+                  this.loginUser.userType.value == 2))
1272
+            ) {
1273
+              //liaomingming
1274
+              this.$http
1275
+                .post("service/common/common/getDictionary", {
1276
+                  key: "incident_integral_state",
1277
+                  type: "list"
1278
+                })
1279
+                .then(result => {
1280
+                  result = result.data;
1281
+                  let auditState = result.find(v => v.value == 0);
1282
+                  let postData = {
1283
+                    incidentIntegral: {
1284
+                      incidentId: res.data.bussId,
1285
+                      auditState: auditState,
1286
+                      handlerUser: this.loginUser.id,
1287
+                      handlerUserName: this.loginUser.name,
1288
+                      sourceScore: this.$refs.seiminModel.complexitySource,
1289
+                      currentScore: this.$refs.seiminModel.complexity,
1290
+                      updateReason:
1291
+                        this.$refs.seiminModel.updateReason.trim() || undefined
1292
+                    }
1293
+                  };
1294
+                  this.$http
1295
+                    .post("service/bpm/data/addData/incidentIntegral", postData)
1296
+                    .then(result1 => {
1297
+                      if (result1.data.status == 200) {
1298
+                        this.commonFn();
1299
+                      } else {
1300
+                        this.$createDialog({
1301
+                          type: "alert",
1302
+                          title: "系统错误,请稍后再试!",
1303
+                          content: "",
1304
+                          icon: "cubeic-wrong"
1305
+                        }).show();
1306
+                      }
1307
+                    });
1308
+                });
1309
+            } else {
1310
+              this.commonFn();
1311
+            }
1206 1312
           } else {
1207 1313
             $("#fade").fadeIn();
1208 1314
             that.promptingConent = "系统错误,请稍后再试!";
@@ -1224,7 +1330,6 @@ export default {
1224 1330
             }, 2000);
1225 1331
           }
1226 1332
         });
1227
-      event.preventDefault();
1228 1333
     },
1229 1334
     validateHandler(result) {
1230 1335
       // this.submitHandler()
@@ -1676,6 +1781,7 @@ export default {
1676 1781
     }
1677 1782
   },
1678 1783
   components: {
1784
+    seiminModel,
1679 1785
     CubePage,
1680 1786
     CubeButtonGroup,
1681 1787
     DatePicker,

File diff suppressed because it is too large
+ 321 - 203
src/views/processing.vue