Explorar o código

Merge branch 'master' of http://git.dashitech.com/seimin/itsm-wx-handle

maotao hai 10 meses
pai
achega
91f6aa5917

+ 321 - 12
pages/assign/assign.vue

@@ -57,6 +57,77 @@
57 57
         </view>
58 58
       </template>
59 59
       
60
+      <!-- 补单 -->
61
+      <template v-if="dataInfo.tabActiveValue === 'supplement' && dataInfo.supplementFlag">
62
+        <view class="form_item">
63
+          <view class="title select"><text class="required newicon newicon-bitian"></text>登记时间:</view>
64
+          <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.acceptDate" :class="{formRed: isSubmit && !dataInfo.acceptDate}" />
65
+      	</view>
66
+        <view class="form_item">
67
+          <view class="title select"><text class="required newicon newicon-bitian"></text>接单时间:</view>
68
+          <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.responseHandleTime" :class="{formRed: isSubmit && !dataInfo.responseHandleTime}" />
69
+        </view>
70
+        <view class="form_item">
71
+          <view class="title select"><text class="required newicon newicon-bitian"></text>解决时间:</view>
72
+          <uni-datetime-picker class="value" type="datetime" v-model="dataInfo.handleTime" :class="{formRed: isSubmit && !dataInfo.handleTime}" />
73
+        </view>
74
+        <view class="form_item">
75
+          <view class="title select"><text class="required newicon newicon-bitian"></text>处理人:</view>
76
+        	<uni-data-picker class="value" placeholder="请选择处理人"
77
+        		:localdata="dataInfo.userList" v-model="dataInfo.handlingPersonnelUserId" 
78
+        		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.handlingPersonnelUserId}">
79
+        	</uni-data-picker>
80
+        </view>
81
+      </template>
82
+      
83
+      <!-- 补单-下一步 -->
84
+      <template v-if="dataInfo.tabActiveValue === 'supplement' && !dataInfo.supplementFlag">
85
+        <view class="form_item column" v-if="dataInfo.category.hasSimple != 1">
86
+          <view class="title"><text class="required newicon newicon-bitian"></text>解决方案:</view>
87
+          <uni-easyinput class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
88
+        </view>
89
+        <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
90
+          <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
91
+          <view class="value category" @click="selectCategory('assign_supplement')">
92
+            <text class="categoryName ellipsis-multiline">{{dataInfo.category.mutiCategory}}</text>
93
+            <text class="newicon newicon-weibiaoti2010104"></text>
94
+          </view>
95
+        </view>
96
+        <view class="form_item">
97
+          <view class="title select"><text class="required newicon newicon-bitian"></text>处理方式:</view>
98
+        	<uni-data-picker class="value" placeholder="请选择处理方式"
99
+        		:localdata="dataInfo.handleCategoryList" v-model="dataInfo.handleCategory" 
100
+        		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.handleCategory}">
101
+        	</uni-data-picker>
102
+        </view>
103
+        <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
104
+          <view class="title select"><text class="required newicon newicon-bitian"></text>处理结果:</view>
105
+        	<uni-data-picker class="value" placeholder="请选择处理结果"
106
+        		:localdata="dataInfo.closecodeList" v-model="dataInfo.closecode" 
107
+        		:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.closecode}">
108
+        	</uni-data-picker>
109
+        </view>
110
+        <view class="form_item">
111
+          <view class="title"><text class="required newicon newicon-bitian transparent"></text>协同人员:</view>
112
+          <text class="synergeticNames ellipsis">{{dataInfo.synergetic.map(v => v.name).join(',')}}</text>
113
+          <button type="primary" plain size="mini" class="primaryPlainButton synergeticAdd" @click="synergeticAdd('assign_supplement')">+立即添加</button>
114
+        </view>
115
+        <view class="form_item_column">
116
+          <view class="form_item">
117
+            <view class="title"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
118
+            <view class="value">
119
+              <uni-file-picker ref="handlerImgRef" v-model="dataInfo.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete"></uni-file-picker>
120
+            </view>
121
+          </view>
122
+          <view class="form_item">
123
+            <view class="title transparent"><text class="required newicon newicon-bitian transparent"></text>处理图片:</view>
124
+            <view class="value">
125
+              <text class="imgTips ellipsis">(支持JPG/PNG格式图片,单张大小10M以内)</text>
126
+            </view>
127
+          </view>
128
+        </view>
129
+      </template>
130
+      
60 131
       <!-- 派单 -->
61 132
       <template v-if="dataInfo.tabActiveValue === 'assign'">
62 133
         <view class="form_item">
@@ -97,8 +168,15 @@
97 168
 		</view>
98 169
     <!-- </scroll-view> -->
99 170
     <view class="foot_common_btns">
100
-      <button @click="goBack" type="default" class="cancelButton btn">返回</button>
101
-      <button @click="submit" type="default" class="primaryButton btn">提交</button>
171
+      <template v-if="dataInfo.tabActiveValue === 'supplement' && dataInfo.supplementFlag">
172
+        <button @click="goBack" type="default" class="primaryButton btn">上一步</button>
173
+        <button @click="next" type="default" class="primaryButton btn">下一步</button>
174
+      </template>
175
+      <template v-else>
176
+        <button @click="previous" type="default" class="primaryButton btn" v-if="dataInfo.tabActiveValue === 'supplement'">上一步</button>
177
+        <button @click="goBack" type="default" class="cancelButton btn" v-else>返回</button>
178
+        <button @click="submit" type="default" class="primaryButton btn">提交</button>
179
+      </template>
102 180
     </view>
103 181
   </view>
104 182
 </template>
@@ -132,6 +210,7 @@
132 210
   const dataInfo = reactive({
133 211
     tabs: [
134 212
       {id: 5, name: '直接处理', value: 'direct', num: ''},
213
+      // {id: 7, name: '补单', value: 'supplement', num: ''},
135 214
       {id: 6, name: '派单', value: 'assign', num: ''},
136 215
     ],
137 216
     tabActiveValue: 0,//当前选择的tab
@@ -164,6 +243,11 @@
164 243
       { text: '是', value: 1 },
165 244
       { text: '否', value: 0 },
166 245
     ], //工作组是否转派到人选项
246
+    supplementFlag: true,//补单是否有下一步
247
+    acceptDate: undefined,//补单-登记时间
248
+    responseHandleTime: undefined,//补单-接单时间
249
+    handleTime: undefined,//补单-解决时间
250
+    handlingPersonnelUserId: undefined,//补单-处理人
167 251
   })
168 252
   
169 253
   // 是否提交
@@ -257,16 +341,16 @@
257 341
   }
258 342
   
259 343
   // 添加协同人员
260
-  function synergeticAdd(){
261
-    handlerStore.setHandlerData(dataInfo, 'assign');
344
+  function synergeticAdd(sign = 'assign'){
345
+    handlerStore.setHandlerData(dataInfo, 'assign', sign);
262 346
     uni.navigateTo({
263 347
       url: `/pages/synergeticAdd/synergeticAdd?incidentId=${dataInfo.incidentId}`
264 348
     })
265 349
   }
266 350
   
267 351
   // 选择故障现象
268
-  function selectCategory(){
269
-    handlerStore.setHandlerData(dataInfo, 'assign');
352
+  function selectCategory(sign = 'assign'){
353
+    handlerStore.setHandlerData(dataInfo, 'assign', sign);
270 354
     uni.navigateTo({
271 355
       url: `/pages/categoryOne/categoryOne?incidentId=${dataInfo.incidentId}`
272 356
     })
@@ -392,6 +476,7 @@
392 476
   
393 477
   // 重置
394 478
   function reset(){
479
+    dataInfo.userList = [];//处理人列表
395 480
     dataInfo.repairTypeList = []; //延期原因列表
396 481
     dataInfo.groupId = undefined; //延期原因ID
397 482
     dataInfo.userIdList = []; //延期天数列表
@@ -421,6 +506,10 @@
421 506
     if(dataInfo.tabActiveValue === 'direct'){
422 507
       getHandleCategorys();
423 508
       getClosecodes();
509
+    }else if(dataInfo.tabActiveValue === 'supplement'){
510
+      getHandleCategorys();
511
+      getClosecodes();
512
+      getUsers();
424 513
     }else if(dataInfo.tabActiveValue === 'assign'){
425 514
       getGroups();
426 515
     }
@@ -483,8 +572,11 @@
483 572
     })
484 573
   }
485 574
   
486
-  // 获取用户列表
487
-  function getUsers(){
575
+  /**
576
+   * 获取用户列表
577
+   * @param {boolean} noGroup 是否查询组里的用户
578
+   */
579
+  function getUsers(noGroup = false){
488 580
     uni.showLoading({
489 581
       title: "加载中",
490 582
       mask: true,
@@ -494,9 +586,7 @@
494 586
       "sum": 9999,
495 587
       "user": {
496 588
         "duty": dataInfo.incidentData.duty || undefined,
497
-        "groupdata":{
498
-          "id": dataInfo.groupId,
499
-        },
589
+        "groupdata": (dataInfo.groupId && !noGroup) ? { "id": dataInfo.groupId } : undefined,
500 590
         "roledata": {
501 591
             "rolecode": "first-line support"
502 592
         },
@@ -587,11 +677,57 @@
587 677
     })
588 678
   }
589 679
   
680
+  // 补单-上一步
681
+  function previous(){
682
+    dataInfo.supplementFlag = true;
683
+  }
684
+  
685
+  // 补单-下一步
686
+  function next(){
687
+    console.log(dataInfo)
688
+    isSubmit.value = true;
689
+    if(!dataInfo.acceptDate){
690
+      uni.showToast({
691
+      	icon: 'none',
692
+        title: '请选择登记时间'
693
+      });
694
+      return;
695
+    }
696
+    
697
+    if(!dataInfo.responseHandleTime){
698
+      uni.showToast({
699
+      	icon: 'none',
700
+        title: '请选择接单时间'
701
+      });
702
+      return;
703
+    }
704
+    
705
+    if(!dataInfo.handleTime){
706
+      uni.showToast({
707
+      	icon: 'none',
708
+        title: '请选择解决时间'
709
+      });
710
+      return;
711
+    }
712
+    
713
+    if(!dataInfo.handlingPersonnelUserId){
714
+      uni.showToast({
715
+      	icon: 'none',
716
+        title: '请选择处理人'
717
+      });
718
+      return;
719
+    }
720
+    dataInfo.supplementFlag = false;
721
+    isSubmit.value = false;
722
+  }
723
+  
590 724
   // 提交
591 725
   function submit(){
592 726
     isSubmit.value = true;
593 727
     if(dataInfo.tabActiveValue === 'direct'){
594 728
       submitHandler();
729
+    }else if(dataInfo.tabActiveValue === 'supplement'){
730
+      submitSupplement();
595 731
     }else if(dataInfo.tabActiveValue === 'assign'){
596 732
       submitAssign();
597 733
     }
@@ -625,6 +761,40 @@
625 761
     return api_incidentTask('accept', postData);
626 762
   }
627 763
   
764
+  // 补单提交事件
765
+  async function supplementOrder(){
766
+    let postData = {
767
+      incident: dataInfo.incidentData,
768
+    }
769
+    
770
+    let result = await beforeBuild();
771
+    if(result[0].status == 200 && result[1].status == 200){
772
+      postData.incident.repairType = result[0].list.length ? result[0].list[0].valueconfig : undefined;
773
+      postData.incident.incidentsign = result[1].data || undefined;
774
+    }else{
775
+      uni.showToast({
776
+        icon: 'none',
777
+        title: '请求数据失败!'
778
+      });
779
+      return;
780
+    }
781
+    
782
+    postData.incident.handleDescription = dataInfo.handleDescription;
783
+    postData.incident.handleCategory = {id: dataInfo.handleCategory};
784
+    postData.incident.closecode = {id: dataInfo.closecode};
785
+    postData.incident.category = dataInfo.category;
786
+    postData.incident.synergetic = dataInfo.synergetic;
787
+    postData.incident.directProcess = 1;//直接解决
788
+    
789
+    postData.incident.acceptDate = dataInfo.acceptDate;
790
+    postData.incident.responseHandleTime = dataInfo.responseHandleTime;
791
+    postData.incident.handleTime = dataInfo.handleTime;
792
+    postData.incident.handlingPersonnelUser = { id: dataInfo.handlingPersonnelUserId };
793
+    console.log(postData.incident)
794
+    
795
+    return api_incidentTask('patchOrder', postData);
796
+  }
797
+  
628 798
   // 建单前的接口
629 799
   function beforeBuild(){
630 800
     let repairMain$ = api_systemConfiguration({
@@ -871,11 +1041,148 @@
871 1041
    
872 1042
   }
873 1043
   
1044
+  // 补单提交
1045
+  function submitSupplement(){
1046
+    console.log(dataInfo);
1047
+    if(!dataInfo.handleDescription.trim() && dataInfo.category.hasSimple != 1){
1048
+      uni.showToast({
1049
+      	icon: 'none',
1050
+        title: '请填写解决方案'
1051
+      });
1052
+      return;
1053
+    }
1054
+    
1055
+    if(!dataInfo.category.id && dataInfo.category.hasSimple != 1){
1056
+      uni.showToast({
1057
+      	icon: 'none',
1058
+        title: '请选择故障现象'
1059
+      });
1060
+      return;
1061
+    }
1062
+    
1063
+    if(!dataInfo.handleCategory){
1064
+      uni.showToast({
1065
+      	icon: 'none',
1066
+        title: '请选择处理方式'
1067
+      });
1068
+      return;
1069
+    }
1070
+    
1071
+    if(!dataInfo.closecode && dataInfo.category.hasSimple != 1){
1072
+      uni.showToast({
1073
+      	icon: 'none',
1074
+        title: '请选择处理结果'
1075
+      });
1076
+      return;
1077
+    }
1078
+    
1079
+    if(!dataInfo.incidentData.duty){
1080
+      uni.showToast({
1081
+      	icon: 'none',
1082
+        title: '您选择的故障现象没有设置责任科室'
1083
+      });
1084
+      return;
1085
+    }
1086
+    console.log(dataInfo)
1087
+    console.log(dataInfo.handlerImgList)
1088
+    console.log(dataInfo.incidentData.repairImgList)
1089
+    
1090
+    uni.showLoading({
1091
+      title: "加载中",
1092
+      mask: true,
1093
+    });
1094
+    
1095
+    if(dataInfo.handlerImgList.length){
1096
+      // 有处理图片
1097
+      let supplementOrder$ = supplementOrder();
1098
+      let requestList = [supplementOrder$];
1099
+      Promise.all(requestList).then(resList => {
1100
+        console.log(resList);
1101
+        if(resList[0].state == 200){
1102
+          dataInfo.incidentId = resList[0].data.id;
1103
+          handlerImgRef.value.upload();
1104
+        }else{
1105
+          uni.hideLoading();
1106
+          uni.showToast({
1107
+            icon: 'none',
1108
+            title: resList[0].msg || '请求数据失败!'
1109
+          });
1110
+        }
1111
+      })
1112
+    }else if(dataInfo.incidentData.repairImgList.length){
1113
+      // 有报修图片,无处理图片
1114
+      let supplementOrder$ = supplementOrder();
1115
+      let requestList = [supplementOrder$];
1116
+      Promise.all(requestList).then(resList => {
1117
+        console.log(resList);
1118
+        if(resList[0].state == 200){
1119
+          dataInfo.incidentId = resList[0].data.id;
1120
+          handlerImgSuccessNew();
1121
+        }else{
1122
+          uni.hideLoading();
1123
+          uni.showToast({
1124
+            icon: 'none',
1125
+            title: resList[0].msg || '请求数据失败!'
1126
+          });
1127
+        }
1128
+      })
1129
+    }else{
1130
+      // 没有图片
1131
+      let supplementOrder$ = supplementOrder();
1132
+      let requestList = [supplementOrder$];
1133
+      Promise.all(requestList).then(resList => {
1134
+        uni.hideLoading();
1135
+        console.log(resList);
1136
+        if(resList[0].state == 200){
1137
+          incidentBuildStore.clearIncidentBuildData();
1138
+          uni.showToast({
1139
+          	icon: 'none',
1140
+            title: '建单成功',
1141
+            mask: true,
1142
+          });
1143
+          setTimeout(() => {
1144
+            uni.reLaunch({
1145
+              url: '/pages/incidentList/incidentList',
1146
+            })
1147
+          }, 1500)
1148
+        }else{
1149
+          uni.showToast({
1150
+            icon: 'none',
1151
+            title: resList[0].msg || '请求数据失败!'
1152
+          });
1153
+        }
1154
+      })
1155
+    }
1156
+  }
1157
+  
1158
+  // 菜单权限
1159
+  function menuAuthHandle(){
1160
+    let shijianliebiao_supplement = false;//故障处理权限
1161
+    for (let i = 0; i < loginUserStore.loginUser.menu.length; i++) {
1162
+        if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_supplement") {
1163
+          shijianliebiao_supplement = true
1164
+        }
1165
+    }
1166
+    
1167
+    // 补单
1168
+    if(shijianliebiao_supplement){
1169
+      let index = dataInfo.tabs.findIndex(v => v.value === 'assign');
1170
+      dataInfo.tabs.splice(index, 0, {id: 7, name: '补单', value: 'supplement', num: ''});
1171
+    }
1172
+  }
1173
+  
874 1174
   onLoad((option) => {
1175
+    menuAuthHandle()
875 1176
     // 跳转页面选择了选项
876 1177
     if(handlerStore.handler.data){
877 1178
       Object.assign(dataInfo, handlerStore.handler.data);
878 1179
       console.log(dataInfo)
1180
+      if(handlerStore.handler.sign === 'assign'){
1181
+        dataInfo.tabActiveValue = 'direct';
1182
+      }else if(handlerStore.handler.sign === 'assign_supplement'){
1183
+        dataInfo.tabActiveValue = 'supplement';
1184
+        next();
1185
+      }
879 1186
       handlerStore.clearHandlerData();
880 1187
       
881 1188
       if(dataInfo.category){
@@ -934,7 +1241,9 @@
934 1241
       }
935 1242
     }
936 1243
     
937
-    dataInfo.tabActiveValue = dataInfo.tabs[0].value;
1244
+    if(!dataInfo.tabActiveValue){
1245
+      dataInfo.tabActiveValue = dataInfo.tabs[0].value;
1246
+    }
938 1247
     initForm()
939 1248
   })
940 1249
 </script>

+ 1 - 1
pages/categoryThree/categoryThree.vue

@@ -67,7 +67,7 @@
67 67
     }
68 68
     dataInfo.paramData.category = dataInfo.categoryThreeObj;
69 69
     if(handlerStore.handler.type){
70
-      handlerStore.setHandlerData(dataInfo.paramData, handlerStore.handler.type);
70
+      handlerStore.setHandlerData(dataInfo.paramData, handlerStore.handler.type, handlerStore.handler.sign);
71 71
       uni.navigateTo({
72 72
         url: `/pages/${handlerStore.handler.type}/${handlerStore.handler.type}?incidentId=${dataInfo.incidentId}`,
73 73
       })

+ 1 - 1
pages/synergeticAdd/synergeticAdd.vue

@@ -59,7 +59,7 @@
59 59
       return;
60 60
     }
61 61
     dataInfo.paramData.synergetic = dataInfo.userSelectedList;
62
-    handlerStore.setHandlerData(dataInfo.paramData, handlerStore.handler.type);
62
+    handlerStore.setHandlerData(dataInfo.paramData, handlerStore.handler.type, handlerStore.handler.sign);
63 63
     uni.navigateTo({
64 64
       url: `/pages/${handlerStore.handler.type}/${handlerStore.handler.type}?incidentId=${dataInfo.incidentId}`,
65 65
     })

+ 4 - 2
static/scss/common.scss

@@ -130,10 +130,12 @@ uni-toast,
130 130
   opacity: 0;
131 131
 }
132 132
 
133
-// 下拉框边框红色
133
+// 边框红色
134 134
 .formRed{
135 135
   .uni-select,
136
-  .uni-easyinput__content{
136
+  .uni-easyinput__content,
137
+  .uni-date-x,
138
+  .uni-data-tree-input .input-value{
137 139
     border: 1px solid red!important;
138 140
   }
139 141
 }

+ 9 - 1
stores/handler.js

@@ -7,12 +7,19 @@ export const useHandlerStore = defineStore(
7 7
     const handler = reactive({
8 8
       data: null,
9 9
       type: '',
10
+      sign: '',
10 11
     });
11 12
 
12 13
     // 保存事件信息
13
-    function setHandlerData(data, type) {
14
+    /**
15
+     * @param {Object} data 数据
16
+     * @param {Object} type 路由
17
+     * @param {Object} sign 标识
18
+     */
19
+    function setHandlerData(data, type, sign) {
14 20
       handler.data = data;
15 21
       handler.type = type;
22
+      handler.sign = sign;
16 23
     }
17 24
     
18 25
     // 清空事件信息
@@ -20,6 +27,7 @@ export const useHandlerStore = defineStore(
20 27
       console.log(handler.data)
21 28
       handler.data = null;
22 29
       handler.type = '';
30
+      handler.sign = '';
23 31
     }
24 32
 
25 33
     return {