소스 검색

故障耗材

seimin 10 달 전
부모
커밋
3d91623e5b
3개의 변경된 파일62개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 0
      http/api.js
  2. 51 5
      pages/consumableList/consumableList.vue
  3. 5 0
      static/scss/common.scss

+ 6 - 0
http/api.js

@@ -196,3 +196,9 @@ export function api_sj(){
196 196
   return get("/bpm/bpm/restful/sj");
197 197
 }
198 198
 
199
+/**
200
+ * 获取故障耗材
201
+ */
202
+export function api_incidentCategoryConsumable(data){
203
+  return post("/user/data/fetchDataList/incidentCategoryConsumable", data);
204
+}

+ 51 - 5
pages/consumableList/consumableList.vue

@@ -1,9 +1,9 @@
1 1
 <template>
2 2
   <view class="consumableList">
3
-    <view class="head">
3
+    <view class="head" v-if="isFlag">
4 4
       <uni-search-bar v-model="dataInfo.keyWord" placeholder="请搜索耗材" bgColor="#F8F8F8" @input="search" cancelButton="none" focus :radius="18" />
5 5
     </view>
6
-    <view class="body" v-if="dataInfo.list.length">
6
+    <view class="body" v-if="dataInfo.list.length" :class="{ mt0: !isFlag }">
7 7
       <view class="body_item ellipsis" v-for="data in dataInfo.list" :key="data.id" @click="numberClick(data, 'addConsumable')">
8 8
         {{data.name}}
9 9
         <template v-if="data.brandModel">({{data.brandModel}})</template>
@@ -21,11 +21,11 @@
21 21
 </template>
22 22
 
23 23
 <script setup>
24
-  import { debounce } from 'lodash-es'
24
+  import { debounce, uniqBy } from 'lodash-es'
25 25
   import { ref, reactive} from 'vue'
26 26
   import NumberModal from '@/components/NumberModal.vue';
27 27
   import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
28
-  import { api_consumable, api_incidentDetail, api_addSummaryDoc } from "@/http/api.js"
28
+  import { api_consumable, api_incidentDetail, api_addSummaryDoc, api_incidentCategoryConsumable } from "@/http/api.js"
29 29
   import { defaultColor } from '@/static/js/theme.js'
30 30
   import { useSetTitle } from '@/share/useSetTitle.js'
31 31
   import { useLoginUserStore } from '@/stores/loginUser'
@@ -139,8 +139,54 @@
139 139
   // 搜索
140 140
   const search = debounce(getList.bind(null, 0), 500);
141 141
   
142
+  // 是否没有故障耗材配置
143
+  const isFlag = ref(false);
144
+  
145
+  // 获取故障耗材配置
146
+  async function getIncidentCategoryConsumable(){
147
+    uni.showLoading({
148
+      title: "加载中",
149
+      mask: true,
150
+    });
151
+    
152
+    let postData = {
153
+      idx: 0,
154
+      sum: 20,
155
+      incidentCategoryConsumable: {
156
+        duty: dataInfo.incidentData.duty.id,
157
+        category: dataInfo.incidentData.category,
158
+      }
159
+    }
160
+    
161
+    let res = await api_incidentCategoryConsumable(postData);
162
+    uni.hideLoading();
163
+    uni.stopPullDownRefresh();
164
+    if(res.status == 200){
165
+      let list = res.list || [];
166
+      if(list.length){
167
+        isFlag.value = false;
168
+        let arr = list.map(v => v.consumableDTOS).flat();
169
+        dataInfo.list = uniqBy(arr, 'id');
170
+      }else{
171
+        isFlag.value = true;
172
+      }
173
+    }else{
174
+      isFlag.value = false;
175
+      uni.showToast({
176
+        icon: 'none',
177
+        title: res.msg || '请求数据失败!'
178
+      });
179
+    }
180
+  }
181
+  
142 182
   // 获取列表信息
143
-  function getList(idx){
183
+  async function getList(idx){
184
+    // 判断是否满足故障耗材配置
185
+    await getIncidentCategoryConsumable();
186
+    if(!isFlag.value){
187
+      return;
188
+    }
189
+    
144 190
     if(dataInfo.keyWord.trim() === ''){
145 191
       dataInfo.list = [];
146 192
       uni.stopPullDownRefresh();

+ 5 - 0
static/scss/common.scss

@@ -200,3 +200,8 @@ uni-toast,
200 200
 .uni-data-checklist .checklist-group .checklist-box.is--list.is-checked .checklist-content .checkobx__list{
201 201
   border-color: $uni-primary!important;
202 202
 }
203
+
204
+// 外边距-top
205
+.mt0{
206
+  margin-top: 0!important;
207
+}