Browse Source

二维码设置修改

seimin 1 year ago
parent
commit
2cbf343fa5
2 changed files with 62 additions and 24 deletions
  1. 39 14
      pages/search/search.vue
  2. 23 10
      pages/settingCode/settingCode.vue

+ 39 - 14
pages/search/search.vue

@@ -9,10 +9,10 @@
9
       <scroll-view class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
9
       <scroll-view class="keyword-list-box" v-show="isShowKeywordList" scroll-y>
10
         <block v-for="(row, index) in keywordList" :key="index">
10
         <block v-for="(row, index) in keywordList" :key="index">
11
           <view class="keyword-entry" hover-class="keyword-entry-tap">
11
           <view class="keyword-entry" hover-class="keyword-entry-tap">
12
-            <view class="keyword-text" @tap.stop="doSearch(keywordList[index].keyword)">
12
+            <view class="keyword-text" @tap.stop="doSearch(row)">
13
               <rich-text :nodes="row.htmlStr"></rich-text>
13
               <rich-text :nodes="row.htmlStr"></rich-text>
14
             </view>
14
             </view>
15
-            <view class="keyword-img" @tap.stop="doSearch(keywordList[index].keyword)">
15
+            <view class="keyword-img" @tap.stop="doSearch(row)">
16
               <image src="/static/HM-search/back.png"></image>
16
               <image src="/static/HM-search/back.png"></image>
17
             </view>
17
             </view>
18
           </view>
18
           </view>
@@ -73,6 +73,7 @@
73
         uniName: '',
73
         uniName: '',
74
         queryDept: '',
74
         queryDept: '',
75
         queryDeptId: '',
75
         queryDeptId: '',
76
+        sourceQr: '',
76
         qrCode: '',
77
         qrCode: '',
77
         // 设置科室二维码 end
78
         // 设置科室二维码 end
78
         // 选择血制品送达科室 start
79
         // 选择血制品送达科室 start
@@ -115,6 +116,7 @@
115
         this.uniName = options.uniName;
116
         this.uniName = options.uniName;
116
         this.queryDept = options.queryDept;
117
         this.queryDept = options.queryDept;
117
         this.queryDeptId = options.queryDeptId;
118
         this.queryDeptId = options.queryDeptId;
119
+        this.sourceQr = options.sourceQr;
118
         this.qrCode = options.qrCode;
120
         this.qrCode = options.qrCode;
119
         this.sysDeptType = -1;
121
         this.sysDeptType = -1;
120
       }  else if (this.type == "pharmacy") { //药房切换科室
122
       }  else if (this.type == "pharmacy") { //药房切换科室
@@ -224,15 +226,34 @@
224
             }
226
             }
225
           }
227
           }
226
         }
228
         }
229
+        
230
+        // 设置二维码
231
+        if(this.type == "settingCode"){
232
+          postData = {
233
+            hosId: this.hosId,
234
+            searchKey: keyword,
235
+          }
236
+        }
237
+        
227
         uni.showLoading({
238
         uni.showLoading({
228
           title: "加载中",
239
           title: "加载中",
229
         });
240
         });
230
-        post("/data/fetchDataList/department", postData).then((res) => {
231
-          if (res.status == 200) {
232
-            this.searchData.push({
233
-              name: keyword,
234
-              list: res.list
235
-            });
241
+        
242
+        post(this.type == "settingCode" ? "/dept/queryChangeDept" : "/data/fetchDataList/department", postData).then((res) => {
243
+          if (res.status == 200 || res.state == 200) {
244
+            if(this.type == "settingCode"){
245
+              let deptList = res.deptList.map(v => ({...v, sign: 'dept'}));
246
+              let qrList = res.qrList.map(v => ({...v.deptDTO, sign: 'qr', qrId: v.id}));
247
+              this.searchData.push({
248
+                name: keyword,
249
+                list: deptList.concat(qrList)
250
+              });
251
+            }else{
252
+              this.searchData.push({
253
+                name: keyword,
254
+                list: res.list
255
+              });
256
+            }
236
             let searchText = this.searchText.detail ? this.searchText.detail.value : this.searchText;
257
             let searchText = this.searchText.detail ? this.searchText.detail.value : this.searchText;
237
             let index = this.searchData.findIndex(item => item.name === searchText);
258
             let index = this.searchData.findIndex(item => item.name === searchText);
238
             this.deptList = index >= 0 ? this.searchData[index].list : [];
259
             this.deptList = index >= 0 ? this.searchData[index].list : [];
@@ -256,10 +277,12 @@
256
           //定义高亮#9f9f9f
277
           //定义高亮#9f9f9f
257
           var html = row.dept.replace(
278
           var html = row.dept.replace(
258
             keyword,
279
             keyword,
259
-            "<span style='color: #9f9f9f;'>" + keyword + "</span>"
280
+            "<span style='color: #9f9f9f;'>" + keyword + "</span>" + (row.sign == 'qr' ? '<span class="red">(配置)</span>' : '')
260
           );
281
           );
261
           html = "<div>" + html + "</div>";
282
           html = "<div>" + html + "</div>";
262
           var tmpObj = {
283
           var tmpObj = {
284
+            id: row.id,
285
+            qrId: row.qrId,
263
             keyword: row.dept,
286
             keyword: row.dept,
264
             htmlStr: html,
287
             htmlStr: html,
265
           };
288
           };
@@ -321,11 +344,12 @@
321
         });
344
         });
322
       },
345
       },
323
       //执行搜索
346
       //执行搜索
324
-      doSearch(keyword) {
325
-        keyword = keyword === false ? this.keyword : keyword;
347
+      doSearch(data) {
348
+        console.log(data);
349
+        let keyword = keyword === false ? this.keyword : data.keyword;
326
         this.keyword = keyword;
350
         this.keyword = keyword;
327
         this.saveKeyword(keyword); //保存为历史
351
         this.saveKeyword(keyword); //保存为历史
328
-        let arr = this.deptList.filter((item) => item.dept === keyword);
352
+        let arr = this.deptList.filter((item) => data.qrId ? (item.qrId === data.qrId) : (item.dept === keyword));
329
         if (arr.length) {
353
         if (arr.length) {
330
           let msg = "";
354
           let msg = "";
331
           if (this.type == "patientInformationList" || this.type == "inspectList" || this.type == "pharmacy") {
355
           if (this.type == "patientInformationList" || this.type == "inspectList" || this.type == "pharmacy") {
@@ -388,12 +412,13 @@
388
             });
412
             });
389
           } else if (this.type == "settingCode") {
413
           } else if (this.type == "settingCode") {
390
             if (this.queryDept) { //替换
414
             if (this.queryDept) { //替换
415
+              console.log(arr);
391
               uni.navigateTo({
416
               uni.navigateTo({
392
-                url: `../settingCode/settingCode?targetId=${arr[0].id}&targetDept=${arr[0].dept}&uniName=${this.uniName}&queryDept=${this.queryDept}&queryDeptId=${this.queryDeptId}&qrCode=${this.qrCode}`,
417
+                url: `../settingCode/settingCode?destQr=${arr[0].qrId || ''}&targetId=${arr[0].id}&targetDept=${arr[0].dept}&uniName=${this.uniName}&queryDept=${this.queryDept}&queryDeptId=${this.queryDeptId}&sourceQr=${this.sourceQr || ''}&qrCode=${this.qrCode}`,
393
               });
418
               });
394
             } else { //设置
419
             } else { //设置
395
               uni.navigateTo({
420
               uni.navigateTo({
396
-                url: `../settingCode/settingCode?targetId=${arr[0].id}&targetDept=${arr[0].dept}&uniName=${this.uniName}&qrCode=${this.qrCode}`,
421
+                url: `../settingCode/settingCode?qrId=${arr[0].qrId || ''}&targetId=${arr[0].id}&targetDept=${arr[0].dept}&uniName=${this.uniName}&qrCode=${this.qrCode}`,
397
               });
422
               });
398
             }
423
             }
399
           }
424
           }

+ 23 - 10
pages/settingCode/settingCode.vue

@@ -5,7 +5,8 @@
5
     </view>
5
     </view>
6
     <view class="scanFont">可通过扫一扫功能设置科室,扫描二维码后设置或替换科室</view>
6
     <view class="scanFont">可通过扫一扫功能设置科室,扫描二维码后设置或替换科室</view>
7
     <view class="scanFont nr">
7
     <view class="scanFont nr">
8
-      <text>查询科室结果:{{queryDept?queryDept.dept:"无"}}</text>
8
+      <text v-if="queryDept">查询科室结果:{{queryDept.dept}}<text v-if="queryDept.sourceQr" class="red">(配置)</text></text>
9
+      <text v-else>查询科室结果:无</text>
9
     </view>
10
     </view>
10
     <view class="scanFont nr red">{{msg}}</view>
11
     <view class="scanFont nr red">{{msg}}</view>
11
     <footTool :settings="settings" @operate="operate"></footTool>
12
     <footTool :settings="settings" @operate="operate"></footTool>
@@ -64,8 +65,10 @@
64
           let postData = {
65
           let postData = {
65
             "type": "update",
66
             "type": "update",
66
             "qrCode": this.qrCode,
67
             "qrCode": this.qrCode,
67
-            "destDept": this.options.targetId,
68
-            "sourceDept": this.queryDept.id
68
+            "sourceQr": this.queryDept.sourceQr ? +this.queryDept.sourceQr : undefined,
69
+            "destQr": this.options.destQr ? +this.options.destQr : undefined,
70
+            "sourceDept": this.queryDept.sourceQr ? undefined : +this.queryDept.id,
71
+            "destDept": this.options.destQr ? undefined : +this.options.targetId,
69
           };
72
           };
70
           post("/dept/scanChangeDept", postData).then((res) => {
73
           post("/dept/scanChangeDept", postData).then((res) => {
71
             uni.hideLoading();
74
             uni.hideLoading();
@@ -90,7 +93,8 @@
90
           let postData = {
93
           let postData = {
91
             "type": "save",
94
             "type": "save",
92
             "qrCode": this.qrCode,
95
             "qrCode": this.qrCode,
93
-            "destDept": this.options.targetId
96
+            "destDept": +this.options.targetId,
97
+            "qrId": this.options.qrId ? +this.options.qrId : undefined,
94
           }
98
           }
95
           post("/dept/scanChangeDept", postData).then((res) => {
99
           post("/dept/scanChangeDept", postData).then((res) => {
96
             uni.hideLoading();
100
             uni.hideLoading();
@@ -122,7 +126,7 @@
122
         console.log(i,this.settings,'seimin')
126
         console.log(i,this.settings,'seimin')
123
         if (this.settings[i].uniName == 'replaceGo') { //替换,去选择科室
127
         if (this.settings[i].uniName == 'replaceGo') { //替换,去选择科室
124
           uni.navigateTo({
128
           uni.navigateTo({
125
-            url: `../search/search?type=settingCode&uniName=${this.settings[i].uniName}&queryDept=${this.queryDept.dept}&queryDeptId=${this.queryDept.id}&qrCode=${this.qrCode}`,
129
+            url: `../search/search?type=settingCode&uniName=${this.settings[i].uniName}&queryDept=${this.queryDept.dept}&queryDeptId=${this.queryDept.id}&sourceQr=${this.queryDept.sourceQr || ''}&qrCode=${this.qrCode}`,
126
           });
130
           });
127
         } else if (this.settings[i].uniName == 'settingGo') { //设置,去选择科室
131
         } else if (this.settings[i].uniName == 'settingGo') { //设置,去选择科室
128
           uni.navigateTo({
132
           uni.navigateTo({
@@ -175,10 +179,18 @@
175
             uni.hideLoading();
179
             uni.hideLoading();
176
             if (res.status == 200) {
180
             if (res.status == 200) {
177
               if (res.data) { //替换
181
               if (res.data) { //替换
178
-                this.queryDept = {
179
-                  dept: res.data.dept,
180
-                  id: res.data.id
181
-                };
182
+                if(res.data.deptDTO){
183
+                  this.queryDept = {
184
+                    dept: res.data.deptDTO.dept,
185
+                    id: res.data.deptDTO.id,
186
+                    sourceQr: res.data.id,
187
+                  };
188
+                }else{
189
+                  this.queryDept = {
190
+                    dept: res.data.dept,
191
+                    id: res.data.id
192
+                  };
193
+                }
182
                 this.settings = [{
194
                 this.settings = [{
183
                   name: '替换',
195
                   name: '替换',
184
                   uniName: 'replaceGo'
196
                   uniName: 'replaceGo'
@@ -212,7 +224,8 @@
212
         this.qrCode = options.qrCode
224
         this.qrCode = options.qrCode
213
         this.queryDept = {
225
         this.queryDept = {
214
           dept: options.queryDept,
226
           dept: options.queryDept,
215
-          id: options.queryDeptId
227
+          id: options.queryDeptId,
228
+          sourceQr: options.sourceQr,
216
         };
229
         };
217
         this.msg = `此二维码绑定${options.targetDept}成功,${this.queryDept.dept}的二维码被清空`;
230
         this.msg = `此二维码绑定${options.targetDept}成功,${this.queryDept.dept}的二维码被清空`;
218
         this.settings = [{
231
         this.settings = [{