seimin 1 年之前
父节点
当前提交
466cdd1f68

+ 9 - 0
pages.json

@@ -165,6 +165,15 @@
165 165
           "titleNView": false
166 166
         }
167 167
       }
168
+    },
169
+    {
170
+      "path": "pages/searchUser/searchUser",
171
+      "style": {
172
+        "h5": {
173
+          "titleNView": false
174
+        },
175
+        "enablePullDownRefresh": true
176
+      }
168 177
     }
169 178
   ],
170 179
   "globalStyle": {

+ 1 - 1
pages/assign/assign.vue

@@ -910,7 +910,7 @@
910 910
         dataInfo.incidentData.source = { id: dataInfo.incidentData.source };
911 911
       }
912 912
       if(dataInfo.incidentData.requester){
913
-        dataInfo.incidentData.requester = { id: dataInfo.incidentData.requester }
913
+        dataInfo.incidentData.requester = dataInfo.incidentData.requester
914 914
       }
915 915
     }
916 916
     

+ 14 - 37
pages/buildIncident/buildIncident.vue

@@ -13,8 +13,11 @@
13 13
         </view>
14 14
       </view>
15 15
       <view class="form_item">
16
-        <view class="title select"><text class="required newicon newicon-bitian transparent"></text>报修人:</view>
17
-        <uni-data-select readonly class="value" v-model="incidentData.requester" :localdata="dataInfo.requesterList" placeholder="请选择报修人"></uni-data-select>
16
+        <view class="title"><text class="required newicon newicon-bitian transparent"></text>报修人:</view>
17
+        <view class="value category" @click="selectRequester">
18
+          <text class="categoryName ellipsis-multiline">{{incidentData.requester ? incidentData.requester.name : ''}}</text>
19
+          <text class="newicon newicon-weibiaoti2010104"></text>
20
+        </view>
18 21
       </view>
19 22
       <view class="form_item">
20 23
         <view class="title select"><text class="required newicon newicon-bitian transparent"></text>联系人:</view>
@@ -80,7 +83,7 @@
80 83
 <script setup>
81 84
   import { ref, reactive } from 'vue'
82 85
   import { onLoad } from '@dcloudio/uni-app'
83
-  import { api_user, api_branch, api_getDictionary, api_incidentTask } from "@/http/api.js"
86
+  import { api_branch, api_getDictionary, api_incidentTask } from "@/http/api.js"
84 87
   import { defaultColor } from '@/static/js/theme.js'
85 88
   import { useSetTitle } from '@/share/useSetTitle.js'
86 89
   import { useGoBack } from '@/share/useGoBack.js'
@@ -127,7 +130,6 @@
127 130
   // 数据
128 131
   const dataInfo = reactive({
129 132
     branchList: [], //院区列表
130
-    requesterList: [], //报修人列表
131 133
     sourceList: [], //故障来源列表
132 134
     priorityList: [], //优先级列表
133 135
   })
@@ -186,6 +188,14 @@
186 188
       url: `/pages/searchDept/searchDept`
187 189
     })
188 190
   }
191
+  
192
+  // 跳转到搜索报修人
193
+  function selectRequester(){
194
+    incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident', 'requester');
195
+    uni.navigateTo({
196
+      url: `/pages/searchUser/searchUser`
197
+    })
198
+  }
189 199
 
190 200
   // 获取院区列表
191 201
   function getBranchs(){
@@ -225,38 +235,6 @@
225 235
     })
226 236
   }
227 237
 
228
-  // 获取报修人列表
229
-  function getRequesters(){
230
-    uni.showLoading({
231
-      title: "加载中",
232
-      mask: true,
233
-    });
234
-    let postData = {
235
-      "idx": 0,
236
-      "sum": 9999,
237
-      "user": {
238
-        "simple": true,
239
-        "engineer": undefined,
240
-      }
241
-    };
242
-    api_user(postData).then(res => {
243
-      uni.hideLoading();
244
-      if(res.status == 200){
245
-        res.list = res.list || [];
246
-        dataInfo.requesterList = res.list.map(v => ({
247
-          text: v.name,
248
-          value: v.id,
249
-        }));
250
-
251
-      }else{
252
-        uni.showToast({
253
-          icon: 'none',
254
-          title: res.msg || '请求数据失败!'
255
-        });
256
-      }
257
-    })
258
-  }
259
-
260 238
   // 获取故障来源列表
261 239
   function getSources(){
262 240
     uni.showLoading({
@@ -428,7 +406,6 @@
428 406
       }
429 407
     }
430 408
     getBranchs();
431
-    getRequesters();
432 409
     getSources();
433 410
     getPrioritys();
434 411
   })

+ 1 - 1
pages/incidentList/incidentList.vue

@@ -39,7 +39,7 @@
39 39
         <view class="body_item_foot">
40 40
           <view class="foot_info">
41 41
             <view class="name" @click.stop="makePhoneCall(data.contactsInformation)">联系电话:{{data.contactsInformation}}<uni-icons type="phone-filled" class="phone-filled" :size="18" :color="primaryColor"></uni-icons></view>
42
-            <text class="date">{{formatDate(data.startDate, 'MM-dd HH:mm')}}</text>
42
+            <text class="date">{{formatDate(data.acceptDate, 'MM-dd HH:mm')}}</text>
43 43
           </view>
44 44
           <view class="btns">
45 45
             <button @click.stop="handler('changeUser', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && assignFlag)">换人处理</button>

+ 7 - 1
pages/searchDept/searchDept.vue

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <view class="consumableList">
3 3
     <view class="head">
4
-      <uni-search-bar v-model="dataInfo.keyWord" placeholder="请搜索报修科室" bgColor="#F8F8F8" @input="search" cancelButton="none" focus :radius="18" />
4
+      <uni-search-bar v-model="dataInfo.keyWord" :placeholder="placeHolder" bgColor="#F8F8F8" @input="search" cancelButton="none" focus :radius="18" />
5 5
     </view>
6 6
     <view class="body" v-if="dataInfo.list.length">
7 7
       <view class="body_item ellipsis" v-for="data in dataInfo.list" :key="data.id" @click="clickItem(data)">
@@ -36,6 +36,9 @@
36 36
   // 主题颜色
37 37
   const primaryColor = ref(defaultColor)
38 38
   
39
+  // placeHolder
40
+  const placeHolder = ref('');
41
+  
39 42
   // 数据
40 43
   const dataInfo = reactive({
41 44
     list: [],//工单列表
@@ -110,6 +113,9 @@
110 113
     if(incidentBuildStore.incidentBuild.data){
111 114
       dataInfo.incidentData = incidentBuildStore.incidentBuild.data;
112 115
     }
116
+    if(incidentBuildStore.incidentBuild.type === 'buildIncident' && incidentBuildStore.incidentBuild.sign === 'department'){
117
+      placeHolder.value = '请搜索报修科室'
118
+    }
113 119
     getList(0);
114 120
   })
115 121
   

+ 178 - 0
pages/searchUser/searchUser.vue

@@ -0,0 +1,178 @@
1
+<template>
2
+  <view class="consumableList">
3
+    <view class="head">
4
+      <uni-search-bar v-model="dataInfo.keyWord" :placeholder="placeHolder" bgColor="#F8F8F8" @input="search" cancelButton="none" focus :radius="18" />
5
+    </view>
6
+    <view class="body" v-if="dataInfo.list.length">
7
+      <view class="body_item ellipsis" v-for="data in dataInfo.list" :key="data.id" @click="clickItem(data)">
8
+        {{data.name}}<template v-if="data.account">({{data.account}})</template>
9
+      </view>
10
+    </view>
11
+    <view class="zanwu" v-else>
12
+      <text class="newicon newicon-zanwu"></text>
13
+    </view>
14
+    <view class="foot_common_btns">
15
+      <button @click="goBack" type="default" class="primaryButton btn">返回</button>
16
+    </view>
17
+  </view>
18
+</template>
19
+
20
+<script setup>
21
+  import { debounce } from 'lodash-es'
22
+  import { ref, reactive} from 'vue'
23
+  import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
24
+  import { api_user } from "@/http/api.js"
25
+  import { defaultColor } from '@/static/js/theme.js'
26
+  import { useSetTitle } from '@/share/useSetTitle.js'
27
+  import { useLoginUserStore } from '@/stores/loginUser'
28
+  import { useIncidentBuildStore } from '@/stores/incidentBuild'
29
+  import { useGoBack } from '@/share/useGoBack.js'
30
+  
31
+  useSetTitle();
32
+  const loginUserStore = useLoginUserStore();
33
+  const incidentBuildStore = useIncidentBuildStore();
34
+  const { goBack }  = useGoBack();
35
+  
36
+  // 主题颜色
37
+  const primaryColor = ref(defaultColor)
38
+  
39
+  // placeHolder
40
+  const placeHolder = ref('');
41
+  
42
+  // 数据
43
+  const dataInfo = reactive({
44
+    list: [],//工单列表
45
+    idx: 0,//页码
46
+    hasMore: true,//是否有更多数据
47
+    incidentData: {},//事件对象
48
+    keyWord: '',//搜索的关键词
49
+  })
50
+  
51
+  // 搜索
52
+  const search = debounce(getList.bind(null, 0), 500);
53
+  
54
+  // 获取列表信息
55
+  function getList(idx){
56
+    if(dataInfo.keyWord.trim() === ''){
57
+      dataInfo.list = [];
58
+      uni.stopPullDownRefresh();
59
+      return;
60
+    }
61
+    
62
+    uni.showLoading({
63
+      title: "加载中",
64
+      mask: true,
65
+    });
66
+    
67
+    dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
68
+    if(dataInfo.idx === 0){
69
+      dataInfo.list = [];
70
+    }
71
+
72
+    let postData = {
73
+      idx: dataInfo.idx,
74
+      sum: 20,
75
+      user: {
76
+        simple: true,
77
+        engineer: undefined,
78
+        selectType: "pinyin_all",
79
+        name: dataInfo.keyWord,
80
+      }
81
+    }
82
+    
83
+    api_user(postData).then(res => {
84
+      uni.hideLoading();
85
+      uni.stopPullDownRefresh();
86
+      if(res.status == 200){
87
+        let list = res.list || [];
88
+        if(list.length){
89
+          dataInfo.hasMore = true;
90
+          dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
91
+        }else{
92
+          dataInfo.hasMore = false;
93
+        }
94
+      }else{
95
+        uni.showToast({
96
+          icon: 'none',
97
+          title: res.msg || '请求数据失败!'
98
+        });
99
+      }
100
+    })
101
+  }
102
+  
103
+  // 点击
104
+  function clickItem(data){
105
+    dataInfo.incidentData.requester = data;
106
+    incidentBuildStore.setIncidentBuildData(dataInfo.incidentData, incidentBuildStore.incidentBuild.type, incidentBuildStore.incidentBuild.sign);
107
+    uni.navigateTo({
108
+      url: '/pages/buildIncident/buildIncident'
109
+    })
110
+  }
111
+  
112
+  onLoad((option) => {
113
+    if(incidentBuildStore.incidentBuild.data){
114
+      dataInfo.incidentData = incidentBuildStore.incidentBuild.data;
115
+    }
116
+    if(incidentBuildStore.incidentBuild.type === 'buildIncident' && incidentBuildStore.incidentBuild.sign === 'requester'){
117
+      placeHolder.value = '请搜索报修人'
118
+    }
119
+    getList(0);
120
+  })
121
+  
122
+  onPullDownRefresh(() => {
123
+    getList(0)
124
+  })
125
+  
126
+  onReachBottom(() => {
127
+    dataInfo.idx += 1;
128
+    if (dataInfo.hasMore) {
129
+      getList(); // 当触底时加载更多数据
130
+    }
131
+  })
132
+</script>
133
+
134
+<style lang="scss" scoped>
135
+.consumableList{
136
+  display: flex;
137
+  flex-direction: column;
138
+  justify-content: space-between;
139
+  .head{
140
+    height: 88rpx;
141
+    display: flex;
142
+    align-items: center;
143
+    justify-content: center;
144
+    padding: 0 24rpx;
145
+    position: fixed;
146
+    z-index: 99;
147
+    width: 100%;
148
+    box-sizing: border-box;
149
+    background: linear-gradient( 90deg, #58CF66 0%, #DDE9FC 100%);
150
+  }
151
+  .body{
152
+    margin-bottom: 140rpx;
153
+    margin-top: 88rpx;
154
+    font-size: 26rpx;
155
+    .body_item{
156
+      border-bottom: 1rpx solid #DEDEDE;
157
+      padding: 24rpx;
158
+    }
159
+  }
160
+  .zanwu{
161
+    margin-bottom: 140rpx;
162
+    margin-top: 88rpx;
163
+    display: flex;
164
+    justify-content: center;
165
+    .newicon-zanwu{
166
+      font-size: 256rpx;
167
+      color: #D6D6D6;
168
+      margin-top: 140rpx;
169
+    }
170
+  }
171
+  .foot_common_btns{
172
+    position: fixed;
173
+    left: 0;
174
+    bottom: 0;
175
+    background-color: #fff;
176
+  }
177
+}
178
+</style>